mirror of
https://github.com/mattermost/mattermost.git
synced 2025-02-25 18:55:24 -06:00
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.
This commit is contained in:
committed by
Carlos Tadeu Panato Junior
parent
6a4d21d056
commit
af984b71e9
@@ -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)
|
||||
}))
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user