Limit read bytes instead of ReadAll (#35928) (#35934)

Backport #35928 by wxiaoguang

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
This commit is contained in:
Giteabotandwxiaoguang authored and GitHub committed 2025-11-13 02:26:27 +08:00
1 parent 1d9ae7ac23
commit 01fa8b2b7e
10 files changed
+64 -30

No files matched your search

+1 -1
View File
@@ -133,7 +133,7 @@ func wikiContentsByEntry(ctx *context.Context, entry *git.TreeEntry) []byte {
return nil
}
defer reader.Close()
content, err := io.ReadAll(reader)
content, err := util.ReadWithLimit(reader, 5*1024*1024) // 5MB should be enough for a wiki page
if err != nil {
ctx.ServerError("ReadAll", err)
return nil