From eb85e8e32897f70c55af6c8c3070139488524160 Mon Sep 17 00:00:00 2001 From: astaxie Date: Sun, 20 Sep 2015 19:59:30 +0800 Subject: [PATCH] path.Clean can't clean window separate .." " --- staticfile.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/staticfile.go b/staticfile.go index c85f17e0..1ce9e561 100644 --- a/staticfile.go +++ b/staticfile.go @@ -18,6 +18,7 @@ import ( "net/http" "os" "path" + "path/filepath" "strconv" "strings" @@ -29,7 +30,7 @@ func serverStaticRouter(ctx *context.Context) { if ctx.Input.Method() != "GET" && ctx.Input.Method() != "HEAD" { return } - requestPath := path.Clean(ctx.Input.Request.URL.Path) + requestPath := filepath.Clean(ctx.Input.Request.URL.Path) i := 0 for prefix, staticDir := range StaticDir { if len(prefix) == 0 {