fix static

pull/161/head
Fenny 2020-02-21 04:16:07 +01:00
parent 1f7d70e5e8
commit 4757c0ea3e
1 changed files with 14 additions and 1 deletions

View File

@ -72,6 +72,14 @@ func (app *App) registerStatic(grpPrefix string, args ...string) {
}
// ./static/compiled => static/compiled
mount := filepath.Clean(root)
if !app.Settings.CaseSensitive {
prefix = strings.ToLower(prefix)
}
if !app.Settings.StrictRouting && len(prefix) > 1 {
prefix = strings.TrimRight(prefix, "/")
}
// Loop over all files
for _, file := range files {
// Ignore the .gzipped files by fasthttp
@ -107,7 +115,12 @@ func (app *App) registerStatic(grpPrefix string, args ...string) {
},
})
}
if !app.Settings.CaseSensitive {
path = strings.ToLower(path)
}
if !app.Settings.StrictRouting && len(prefix) > 1 {
path = strings.TrimRight(path, "/")
}
// Add the route + SendFile(filepath) to routes
app.routes = append(app.routes, &Route{
Method: "GET",