From 63dc2339a07ce2325e98e4579988f7403b87c2b5 Mon Sep 17 00:00:00 2001 From: "Gerasimos (Makis) Maropoulos" Date: Wed, 22 Feb 2017 17:07:21 +0200 Subject: [PATCH] StaticEmbedded, if contains "index.html" then act "/" as "/index.html" as requested here: https://github.com/kataras/iris/issues/633 Former-commit-id: 5504d5e454b663e2bfaa194cba4829d9291c1f84 --- router.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/router.go b/router.go index a7c8d78a..e696bdc1 100644 --- a/router.go +++ b/router.go @@ -525,6 +525,14 @@ func (router *Router) StaticEmbedded(requestPath string, vdir string, assetFn fu h := func(ctx *Context) { reqPath := ctx.Param(paramName) 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 { continue }