mirror of
1
Fork 0

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

Backport #27958 by @yp05327

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

Same to #25131, so use the same method to fix this problem.

Co-authored-by: yp05327 <576951401@qq.com>
This commit is contained in:
Giteabot 2023-11-08 22:45:57 +08:00 committed by GitHub
parent 46ac04ce9d
commit 824d40edc6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 5 deletions

View File

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