0
0
Fork 0
mirror of https://github.com/go-gitea/gitea synced 2024-12-29 05:54:36 +01:00

Fix citation error when the file size is larger than 1024 bytes (#27958)

Mentioned in:
https://github.com/go-gitea/gitea/pull/27931#issuecomment-1798016960

Same to #25131, so use the same method to fix this problem.
This commit is contained in:
yp05327 2023-11-08 15:40:12 +09:00 committed by GitHub
parent 6447b3e6b2
commit f48a863b99
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -716,14 +716,11 @@ func checkCitationFile(ctx *context.Context, entry *git.TreeEntry) {
return
}
defer dataRc.Close()
buf := make([]byte, 1024)
n, err := util.ReadAtMost(dataRc, buf)
ctx.PageData["citationFileContent"], err = blob.GetBlobContent(setting.UI.MaxDisplayFileSize)
if err != nil {
ctx.ServerError("ReadAtMost", err)
ctx.ServerError("GetBlobContent", err)
return
}
buf = buf[:n]
ctx.PageData["citationFileContent"] = string(buf)
break
}
}