summaryrefslogtreecommitdiffstats
path: root/routers
diff options
context:
space:
mode:
authora1012112796 <1012112796@qq.com>2021-04-28 20:35:06 +0800
committerGitHub <noreply@github.com>2021-04-28 12:35:06 +0000
commit1e877613bf941ae9bed17e5b6c5b118bd3107777 (patch)
treee6b34d3244a869dbde02e5194deab29d3d511328 /routers
parentcc7d118b126cf451b1f3f9df72eb2f2e091d7ebc (diff)
downloadgitea-1e877613bf941ae9bed17e5b6c5b118bd3107777.tar.gz
gitea-1e877613bf941ae9bed17e5b6c5b118bd3107777.zip
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>
Diffstat (limited to 'routers')
-rw-r--r--routers/routes/web.go1
-rw-r--r--routers/user/profile.go5
2 files changed, 5 insertions, 1 deletions
diff --git a/routers/routes/web.go b/routers/routes/web.go
index cedab78434..ceb024249e 100644
--- a/routers/routes/web.go
+++ b/routers/routes/web.go
@@ -152,6 +152,7 @@ func WebRoutes() *web.Route {
&public.Options{
Directory: path.Join(setting.StaticRootPath, "public"),
SkipLogging: setting.DisableRouterLog,
+ Prefix: "/assets",
},
))
diff --git a/routers/user/profile.go b/routers/user/profile.go
index bb4c0cd5b1..8ff1ee24ad 100644
--- a/routers/user/profile.go
+++ b/routers/user/profile.go
@@ -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
}