Skip to content

Commit 824d40e

Browse files
GiteaBotyp05327
andauthored
Fix citation error when the file size is larger than 1024 bytes (#27958) (#27965)
Backport #27958 by @yp05327 Mentioned in: #27931 (comment) Same to #25131, so use the same method to fix this problem. Co-authored-by: yp05327 <[email protected]>
1 parent 46ac04c commit 824d40e

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

routers/web/repo/view.go

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -711,14 +711,11 @@ func checkCitationFile(ctx *context.Context, entry *git.TreeEntry) {
711711
return
712712
}
713713
defer dataRc.Close()
714-
buf := make([]byte, 1024)
715-
n, err := util.ReadAtMost(dataRc, buf)
714+
ctx.PageData["citationFileContent"], err = blob.GetBlobContent(setting.UI.MaxDisplayFileSize)
716715
if err != nil {
717-
ctx.ServerError("ReadAtMost", err)
716+
ctx.ServerError("GetBlobContent", err)
718717
return
719718
}
720-
buf = buf[:n]
721-
ctx.PageData["citationFileContent"] = string(buf)
722719
break
723720
}
724721
}

0 commit comments

Comments
 (0)