Skip to content

Commit 679f114

Browse files
yp05327GiteaBot
authored andcommitted
Fix citation error when the file size is larger than 1024 bytes (go-gitea#27958)
Mentioned in: go-gitea#27931 (comment) Same to go-gitea#25131, so use the same method to fix this problem.
1 parent 46ac04c commit 679f114

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

routers/web/repo/view.go

+2-5
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)