1
0
mirror of https://github.com/astaxie/beego.git synced 2024-12-23 04:20:49 +00:00

fix the static file dir

This commit is contained in:
astaxie 2014-09-23 00:03:47 +08:00
parent 727d2f9ea1
commit 7e060e6e5c

View File

@ -68,6 +68,9 @@ func serverStaticRouter(ctx *context.Context) {
if finfo.IsDir() && !DirectoryIndex {
middleware.Exception("403", ctx.ResponseWriter, ctx.Request, "403 Forbidden")
return
} else if ctx.Input.Request.URL.Path[len(ctx.Input.Request.URL.Path)-1] != '/' {
http.Redirect(ctx.ResponseWriter, ctx.Request, ctx.Input.Request.URL.Path+"/", 302)
return
}
//This block obtained from (https://github.com/smithfox/beego) - it should probably get merged into astaxie/beego after a pull request