1
0
mirror of https://github.com/gofiber/fiber.git synced 2025-02-19 13:47:54 +00:00

fix static routing for index.html

This commit is contained in:
wernerr 2020-06-03 21:35:49 +02:00
parent 6e9fae815a
commit 53d79ca070

View File

@ -241,12 +241,14 @@ func (app *App) registerStatic(prefix, root string, config ...Static) *Route {
path := ctx.Path()
if len(path) >= prefixLen {
if isStar && getString(path[0:prefixLen]) == prefix {
path = path[0:0]
path = append(path[0:0], '/')
} else {
path = path[prefixLen:]
path = append(path[prefixLen:], '/')
}
}
path = append([]byte("/"), path...)
if len(path) > 0 && path[0] != '/' {
path = append([]byte("/"), path...)
}
return path
},
PathNotFound: func(ctx *fasthttp.RequestCtx) {