add /assets
as root dir of public files (#15219)
* add `/assets` as root dir of public files Signed-off-by: a1012112796 <1012112796@qq.com> * move serviceworker.js * make fmt * fix some link * fix test * Apply suggestions from code review Co-authored-by: silverwind <me@silverwind.io> * Apply suggestions from code review Co-authored-by: silverwind <me@silverwind.io> Co-authored-by: silverwind <me@silverwind.io> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com> Co-authored-by: zeripath <art27@cantab.net>
This commit is contained in:
parent
cc7d118b12
commit
1e877613bf
12 changed files with 29 additions and 26 deletions
|
@ -152,6 +152,7 @@ func WebRoutes() *web.Route {
|
|||
&public.Options{
|
||||
Directory: path.Join(setting.StaticRootPath, "public"),
|
||||
SkipLogging: setting.DisableRouterLog,
|
||||
Prefix: "/assets",
|
||||
},
|
||||
))
|
||||
|
||||
|
|
|
@ -46,11 +46,14 @@ func GetUserByParams(ctx *context.Context) *models.User {
|
|||
// Profile render user's profile page
|
||||
func Profile(ctx *context.Context) {
|
||||
uname := ctx.Params(":username")
|
||||
|
||||
// Special handle for FireFox requests favicon.ico.
|
||||
if uname == "favicon.ico" {
|
||||
ctx.ServeFile(path.Join(setting.StaticRootPath, "public/img/favicon.png"))
|
||||
return
|
||||
} else if strings.HasSuffix(uname, ".png") {
|
||||
}
|
||||
|
||||
if strings.HasSuffix(uname, ".png") {
|
||||
ctx.Error(http.StatusNotFound)
|
||||
return
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue