Code

Remove query data from the URI path.
authorSebastian Harl <sh@tokkee.org>
Thu, 4 Dec 2014 21:35:54 +0000 (22:35 +0100)
committerSebastian Harl <sh@tokkee.org>
Thu, 4 Dec 2014 21:35:54 +0000 (22:35 +0100)
server/server.go

index c0f449cd451dd8d735107c8d8ca877f6fa5aabbc..2b0c27e9ce0dc9882c00e2d336516f9c4dfe2f48 100644 (file)
@@ -147,6 +147,9 @@ func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
        if len(path) > 0 && path[0] == '/' {
                path = path[1:]
        }
        if len(path) > 0 && path[0] == '/' {
                path = path[1:]
        }
+       if idx := strings.Index(path, "?"); idx != -1 {
+               path = path[:idx]
+       }
        var fields []string
        for _, f := range strings.Split(path, "/") {
                f, err := url.QueryUnescape(f)
        var fields []string
        for _, f := range strings.Split(path, "/") {
                f, err := url.QueryUnescape(f)