mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-08-28 05:03:51 +00:00
blob: use NewTruncatedReader for CodeOwners parsing
tested in tests/integration/pull_review_test.go:TestPullView_CodeOwner
This commit is contained in:
parent
dd79f0ce2b
commit
f708bacfff
3 changed files with 25 additions and 22 deletions
|
@ -439,8 +439,8 @@ func renderFile(ctx *context.Context, entry *git.TreeEntry) {
|
|||
ctx.Data["FileError"] = ctx.Locale.Tr("actions.runs.invalid_workflow_helper", workFlowErr.Error())
|
||||
}
|
||||
} else if slices.Contains([]string{"CODEOWNERS", "docs/CODEOWNERS", ".gitea/CODEOWNERS"}, ctx.Repo.TreePath) {
|
||||
if data, err := blob.GetBlobContent(setting.UI.MaxDisplayFileSize); err == nil {
|
||||
_, warnings := issue_model.GetCodeOwnersFromContent(ctx, data)
|
||||
if rc, size, err := blob.NewTruncatedReader(setting.UI.MaxDisplayFileSize); err == nil {
|
||||
_, warnings := issue_model.GetCodeOwnersFromReader(ctx, rc, size > setting.UI.MaxDisplayFileSize)
|
||||
if len(warnings) > 0 {
|
||||
ctx.Data["FileWarning"] = strings.Join(warnings, "\n")
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue