aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoryp05327 <576951401@qq.com>2023-11-08 15:40:12 +0900
committerGitHub <noreply@github.com>2023-11-08 06:40:12 +0000
commitf48a863b99a8075da290f9dc85d8296c974fb86b (patch)
tree4eb2adc3b264699a9a4d158ce12251cbb2475084
parent6447b3e6b29c8cb264a1ba1db034350a3c4fbd1b (diff)
downloadgitea-f48a863b99a8075da290f9dc85d8296c974fb86b.tar.gz
gitea-f48a863b99a8075da290f9dc85d8296c974fb86b.zip
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.
-rw-r--r--routers/web/repo/view.go7
1 files changed, 2 insertions, 5 deletions
diff --git a/routers/web/repo/view.go b/routers/web/repo/view.go
index 4dfa01d8e2..89bb1839e1 100644
--- a/routers/web/repo/view.go
+++ b/routers/web/repo/view.go
@@ -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
}
}