code refactor

This commit is contained in:
JessonChan 2015-09-22 13:46:20 +08:00
parent 936cb735e1
commit 4995f91547
1 changed files with 3 additions and 3 deletions

View File

@ -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
}