mirror of
https://github.com/astaxie/beego.git
synced 2024-12-23 02:40:50 +00:00
fix the static url with / problem
This commit is contained in:
parent
631b4d36f9
commit
4906b600e3
@ -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
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user