mirror of
https://github.com/astaxie/beego.git
synced 2024-11-22 16:50:54 +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, "/") {
|
if !strings.HasPrefix(url, "/") {
|
||||||
url = "/" + url
|
url = "/" + url
|
||||||
}
|
}
|
||||||
|
if url != "/" {
|
||||||
url = strings.TrimRight(url, "/")
|
url = strings.TrimRight(url, "/")
|
||||||
|
}
|
||||||
BConfig.WebConfig.StaticDir[url] = path
|
BConfig.WebConfig.StaticDir[url] = path
|
||||||
return BeeApp
|
return BeeApp
|
||||||
}
|
}
|
||||||
@ -282,7 +284,9 @@ func DelStaticPath(url string) *App {
|
|||||||
if !strings.HasPrefix(url, "/") {
|
if !strings.HasPrefix(url, "/") {
|
||||||
url = "/" + url
|
url = "/" + url
|
||||||
}
|
}
|
||||||
|
if url != "/" {
|
||||||
url = strings.TrimRight(url, "/")
|
url = strings.TrimRight(url, "/")
|
||||||
|
}
|
||||||
delete(BConfig.WebConfig.StaticDir, url)
|
delete(BConfig.WebConfig.StaticDir, url)
|
||||||
return BeeApp
|
return BeeApp
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user