Skip to content

Commit 737e2b3

Browse files
brechtvljolheiser
authored andcommitted
Fix 500 error viewing pull request when fork has pull requests disabled (go-gitea#22512)
Swallow error just like in go-gitea#20839, for the case where there is no protected branch. Fixes go-gitea#20826 for me, though I can't tell if this now covers all cases.
1 parent e6e2c2f commit 737e2b3

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

services/pull/update.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,9 @@ func IsUserAllowedToUpdate(ctx context.Context, pull *issues_model.PullRequest,
109109
if pr.ProtectedBranch == nil {
110110
prUnit, err := pr.BaseRepo.GetUnit(unit.TypePullRequests)
111111
if err != nil {
112+
if repo_model.IsErrUnitTypeNotExist(err) {
113+
return false, false, nil
114+
}
112115
log.Error("pr.BaseRepo.GetUnit(unit.TypePullRequests): %v", err)
113116
return false, false, err
114117
}

0 commit comments

Comments
 (0)