1
0
mirror of https://github.com/kataras/iris.git synced 2025-12-18 18:37:05 +00:00

PR #1400 and resolve conflict

Former-commit-id: cb7e939045f72653827a111c6ccdc2af8e456b02
This commit is contained in:
Gerasimos (Makis) Maropoulos
2019-12-13 23:08:26 +02:00
3 changed files with 12 additions and 1 deletions

View File

@@ -492,7 +492,11 @@ func (api *APIBuilder) HandleDir(requestPath, directory string, opts ...DirOptio
continue
}
requestPath := s.RequestPath[strings.Index(s.RequestPath, api.relativePath)+len(api.relativePath):]
slashIdx := strings.IndexByte(s.RequestPath, '/')
if slashIdx == -1 {
slashIdx = 0
}
requestPath = s.RequestPath[slashIdx:]
routes = append(routes, api.CreateRoutes([]string{http.MethodGet}, requestPath, h)...)
getRoute.StaticSites = append(getRoute.StaticSites, s)
}