Fix SSH LFS memory usage (#33455)

Fix #33448
This commit is contained in:
wxiaoguang 2025-01-31 19:05:48 +08:00 committed by GitHub
parent 4f3cc26b4e
commit 0e8738b4b6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
13 changed files with 77 additions and 103 deletions

View file

@ -134,7 +134,9 @@ func DownloadHandler(ctx *context.Context) {
}
contentLength := toByte + 1 - fromByte
ctx.Resp.Header().Set("Content-Length", strconv.FormatInt(contentLength, 10))
contentLengthStr := strconv.FormatInt(contentLength, 10)
ctx.Resp.Header().Set("Content-Length", contentLengthStr)
ctx.Resp.Header().Set("X-Gitea-LFS-Content-Length", contentLengthStr) // we need this header to make sure it won't be affected by reverse proxy or compression
ctx.Resp.Header().Set("Content-Type", "application/octet-stream")
filename := ctx.PathParam("filename")