From 4995f9154780cf2690838658f4c84fa93934af35 Mon Sep 17 00:00:00 2001 From: JessonChan Date: Tue, 22 Sep 2015 13:46:20 +0800 Subject: [PATCH] code refactor --- staticfile.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/staticfile.go b/staticfile.go index 18b44234..5822882d 100644 --- a/staticfile.go +++ b/staticfile.go @@ -34,9 +34,9 @@ func serverStaticRouter(ctx *context.Context) { // special processing : favicon.ico/robots.txt can be in any static dir if requestPath == "/favicon.ico" || requestPath == "/robots.txt" { - - if utils.FileExists("./" + requestPath) { - http.ServeFile(ctx.ResponseWriter, ctx.Request, "./"+requestPath) + file := path.Join(".", requestPath) + if utils.FileExists(file) { + http.ServeFile(ctx.ResponseWriter, ctx.Request, file) return }