Skip to content

Commit

Permalink
Fix citation error when the file size is larger than 1024 bytes (go-g…
Browse files Browse the repository at this point in the history
…itea#27958)

Mentioned in:
go-gitea#27931 (comment)

Same to go-gitea#25131, so use the same method to fix this problem.
  • Loading branch information
yp05327 authored and GiteaBot committed Nov 8, 2023
1 parent 46ac04c commit 679f114
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions routers/web/repo/view.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
Expand Down

0 comments on commit 679f114

Please sign in to comment.