From 4906b600e3a91d2a99accdf8306bc17a7f7784d6 Mon Sep 17 00:00:00 2001 From: astaxie Date: Tue, 2 Feb 2016 12:43:45 +0800 Subject: [PATCH] fix the static url with / problem --- template.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/template.go b/template.go index 1b62cf78..7a38630e 100644 --- a/template.go +++ b/template.go @@ -272,7 +272,9 @@ func SetStaticPath(url string, path string) *App { if !strings.HasPrefix(url, "/") { url = "/" + url } - url = strings.TrimRight(url, "/") + if url != "/" { + url = strings.TrimRight(url, "/") + } BConfig.WebConfig.StaticDir[url] = path return BeeApp } @@ -282,7 +284,9 @@ func DelStaticPath(url string) *App { if !strings.HasPrefix(url, "/") { url = "/" + url } - url = strings.TrimRight(url, "/") + if url != "/" { + url = strings.TrimRight(url, "/") + } delete(BConfig.WebConfig.StaticDir, url) return BeeApp }