summaryrefslogtreecommitdiffstats
path: root/routers/web/web.go
diff options
context:
space:
mode:
authorKN4CK3R <admin@oldschoolhack.me>2022-11-17 18:55:15 +0100
committerGitHub <noreply@github.com>2022-11-18 01:55:15 +0800
commit43ab9324c579a393f778d6842c577a872d0e4265 (patch)
tree0895b0e0e6d7e4182fd193459d0ac3ee0a30fb40 /routers/web/web.go
parentc144942b23eb6e05a60526cc6d2b88b488ca75dd (diff)
downloadgitea-43ab9324c579a393f778d6842c577a872d0e4265.tar.gz
gitea-43ab9324c579a393f778d6842c577a872d0e4265.zip
Fix setting HTTP headers after write (#21833)
The headers can't be modified after it was send to the client.
Diffstat (limited to 'routers/web/web.go')
-rw-r--r--routers/web/web.go5
1 files changed, 4 insertions, 1 deletions
diff --git a/routers/web/web.go b/routers/web/web.go
index d0ee9c5eac..5fefbad88a 100644
--- a/routers/web/web.go
+++ b/routers/web/web.go
@@ -604,7 +604,10 @@ func RegisterRoutes(m *web.Route) {
m.Group("", func() {
m.Get("/favicon.ico", func(ctx *context.Context) {
- ctx.ServeFile(path.Join(setting.StaticRootPath, "public/img/favicon.png"))
+ ctx.SetServeHeaders(&context.ServeHeaderOptions{
+ Filename: "favicon.png",
+ })
+ http.ServeFile(ctx.Resp, ctx.Req, path.Join(setting.StaticRootPath, "public/img/favicon.png"))
})
m.Group("/{username}", func() {
m.Get(".png", func(ctx *context.Context) { ctx.Error(http.StatusNotFound) })