Skip to content

Commit f48a863

Browse files
authored
Fix citation error when the file size is larger than 1024 bytes (#27958)
Mentioned in: #27931 (comment) Same to #25131, so use the same method to fix this problem.
1 parent 6447b3e commit f48a863

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
@@ -716,14 +716,11 @@ func checkCitationFile(ctx *context.Context, entry *git.TreeEntry) {
716716
return
717717
}
718718
defer dataRc.Close()
719-
buf := make([]byte, 1024)
720-
n, err := util.ReadAtMost(dataRc, buf)
719+
ctx.PageData["citationFileContent"], err = blob.GetBlobContent(setting.UI.MaxDisplayFileSize)
721720
if err != nil {
722-
ctx.ServerError("ReadAtMost", err)
721+
ctx.ServerError("GetBlobContent", err)
723722
return
724723
}
725-
buf = buf[:n]
726-
ctx.PageData["citationFileContent"] = string(buf)
727724
break
728725
}
729726
}

0 commit comments

Comments
 (0)