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.
Этот коммит содержится в:
коммит произвёл
Carlos Tadeu Panato Junior
родитель
6a4d21d056
Коммит
af984b71e9
@@ -45,7 +45,8 @@ func (w *Web) InitStatic() {
|
|||||||
// trailing slash. We don't want to use StrictSlash on the w.MainRouter and affect
|
// trailing slash. We don't want to use StrictSlash on the w.MainRouter and affect
|
||||||
// all routes, just /subpath -> /subpath/.
|
// all routes, just /subpath -> /subpath/.
|
||||||
w.MainRouter.HandleFunc("", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
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)
|
||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user