1
0
mirror of https://github.com/astaxie/beego.git synced 2024-11-22 13:10:54 +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 { if finfo.IsDir() && !DirectoryIndex {
middleware.Exception("403", ctx.ResponseWriter, ctx.Request, "403 Forbidden") middleware.Exception("403", ctx.ResponseWriter, ctx.Request, "403 Forbidden")
return 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 //This block obtained from (https://github.com/smithfox/beego) - it should probably get merged into astaxie/beego after a pull request