Commit d08e3d1b authored by astaxie's avatar astaxie Committed by GitHub

Merge pull request #2064 from Maxgis/feature_static

redirect path should add  query params
parents 02330c60 4b3ed531
......@@ -57,7 +57,11 @@ func serverStaticRouter(ctx *context.Context) {
if fileInfo.IsDir() {
requestURL := ctx.Input.URL()
if requestURL[len(requestURL)-1] != '/' {
ctx.Redirect(302, requestURL+"/")
redirectURL := requestURL + "/"
if ctx.Request.URL.RawQuery != "" {
redirectURL = redirectURL + "?" + ctx.Request.URL.RawQuery
}
ctx.Redirect(302, redirectURL)
} else {
//serveFile will list dir
http.ServeFile(ctx.ResponseWriter, ctx.Request, filePath)
......
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