From 727d2f9ea11573a201d8450b4f8c01134a11660d Mon Sep 17 00:00:00 2001 From: astaxie Date: Mon, 22 Sep 2014 23:44:50 +0800 Subject: [PATCH] fix not found when has mulit static dir robot &robots --- staticfile.go | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/staticfile.go b/staticfile.go index a9deabe9..da511793 100644 --- a/staticfile.go +++ b/staticfile.go @@ -31,6 +31,7 @@ func serverStaticRouter(ctx *context.Context) { return } requestPath := path.Clean(ctx.Input.Request.URL.Path) + i := 0 for prefix, staticDir := range StaticDir { if len(prefix) == 0 { continue @@ -41,8 +42,13 @@ func serverStaticRouter(ctx *context.Context) { http.ServeFile(ctx.ResponseWriter, ctx.Request, file) return } else { - http.NotFound(ctx.ResponseWriter, ctx.Request) - return + i++ + if i == len(StaticDir) { + http.NotFound(ctx.ResponseWriter, ctx.Request) + return + } else { + continue + } } } if strings.HasPrefix(requestPath, prefix) {