fix / can use dynamic directory

This commit is contained in:
dingyuanhong 2018-10-01 15:16:35 +08:00
parent ea9c5822e6
commit dff9c8f5fa
1 changed files with 1 additions and 1 deletions

View File

@ -178,7 +178,7 @@ func searchFile(ctx *context.Context) (string, os.FileInfo, error) {
if !strings.Contains(requestPath, prefix) {
continue
}
if len(requestPath) > len(prefix) && requestPath[len(prefix)] != '/' {
if prefix != "/" && len(requestPath) > len(prefix) && requestPath[len(prefix)] != '/' {
continue
}
filePath := path.Join(staticDir, requestPath[len(prefix):])