From dff9c8f5fab1b04e2478659b3e4d080abd672dda Mon Sep 17 00:00:00 2001 From: dingyuanhong <754046513@qq.com> Date: Mon, 1 Oct 2018 15:16:35 +0800 Subject: [PATCH] fix / can use dynamic directory --- staticfile.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/staticfile.go b/staticfile.go index 30ee3dfb..68241a86 100644 --- a/staticfile.go +++ b/staticfile.go @@ -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):])