Commit af984b71 authored by Jesse Hallam's avatar Jesse Hallam Committed by Carlos Tadeu Panato Junior

ensure subpath redirect preserves query string correctly (#9444)

The previous code appended a `/` to the end of the URL, breaking if a
query string was present.
parent 6a4d21d0
......@@ -45,7 +45,8 @@ func (w *Web) InitStatic() {
// trailing slash. We don't want to use StrictSlash on the w.MainRouter and affect
// all routes, just /subpath -> /subpath/.
w.MainRouter.HandleFunc("", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
http.Redirect(w, r, r.URL.String()+"/", http.StatusFound)
r.URL.Path += "/"
http.Redirect(w, r, r.URL.String(), http.StatusFound)
}))
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment