diff options
author | Giteabot <teabot@gitea.io> | 2023-11-08 22:45:57 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-11-08 22:45:57 +0800 |
commit | 824d40edc6630bfb1a288760ef902adab33d7d9d (patch) | |
tree | c0dc43e12bb7de4da2b5f03f05154e0997d8ed1b | |
parent | 46ac04ce9d06316d65eb4f418ccab4f6c8f355a1 (diff) | |
download | gitea-824d40edc6630bfb1a288760ef902adab33d7d9d.tar.gz gitea-824d40edc6630bfb1a288760ef902adab33d7d9d.zip |
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>
-rw-r--r-- | routers/web/repo/view.go | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/routers/web/repo/view.go b/routers/web/repo/view.go index 9085bda395..3ea11943d6 100644 --- a/routers/web/repo/view.go +++ b/routers/web/repo/view.go @@ -711,14 +711,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 } } |