1
1
mirror of https://github.com/go-gitea/gitea synced 2025-08-17 15:08:27 +00:00

Fix setting HTTP headers after write (#21833) (#21874)

Backport #21833
This commit is contained in:
KN4CK3R
2022-11-20 21:14:27 +01:00
committed by GitHub
parent 87630a6583
commit ba16df8da3
4 changed files with 74 additions and 47 deletions

View File

@@ -75,7 +75,9 @@ func enumeratePackages(ctx *context.Context, filename string, pvs []*packages_mo
})
}
ctx.SetServeHeaders(filename + ".gz")
ctx.SetServeHeaders(&context.ServeHeaderOptions{
Filename: filename + ".gz",
})
zw := gzip.NewWriter(ctx.Resp)
defer zw.Close()
@@ -113,7 +115,9 @@ func ServePackageSpecification(ctx *context.Context) {
return
}
ctx.SetServeHeaders(filename)
ctx.SetServeHeaders(&context.ServeHeaderOptions{
Filename: filename,
})
zw := zlib.NewWriter(ctx.Resp)
defer zw.Close()