mirror of
https://github.com/kataras/iris.git
synced 2025-03-14 08:16:28 +01:00
StaticEmbedded, if contains "index.html" then act "/" as "/index.html" as requested here: https://github.com/kataras/iris/issues/633
Former-commit-id: 5504d5e454b663e2bfaa194cba4829d9291c1f84
This commit is contained in:
parent
4de98254fd
commit
63dc2339a0
|
@ -525,6 +525,14 @@ func (router *Router) StaticEmbedded(requestPath string, vdir string, assetFn fu
|
||||||
h := func(ctx *Context) {
|
h := func(ctx *Context) {
|
||||||
reqPath := ctx.Param(paramName)
|
reqPath := ctx.Param(paramName)
|
||||||
for _, path := range names {
|
for _, path := range names {
|
||||||
|
// in order to map "/" as "/index.html"
|
||||||
|
// as requested here: https://github.com/kataras/iris/issues/633#issuecomment-281691851
|
||||||
|
if path == "/index.html" {
|
||||||
|
if reqPath[len(reqPath)-1] == slashByte {
|
||||||
|
reqPath = "/index.html"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if path != reqPath {
|
if path != reqPath {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user