Skip to content

Commit 38a4e2b

Browse files
committed
Prevent 500 is head repo does not have PullRequest unit in IsUserAllowedToUpdate (go-gitea#20839)
Backport go-gitea#20621 Some repositories do not have the PullRequest unit present in their configuration and unfortunately the way that IsUserAllowedToUpdate currently works assumes that this is an error instead of just returning false. This PR simply swallows this error allowing the function to return false. Fix go-gitea#20621 Signed-off-by: Andrew Thornton <[email protected]>
1 parent c40c753 commit 38a4e2b

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
@@ -87,6 +87,9 @@ func IsUserAllowedToUpdate(ctx context.Context, pull *issues_model.PullRequest,
8787
}
8888
headRepoPerm, err := access_model.GetUserRepoPermission(ctx, pull.HeadRepo, user)
8989
if err != nil {
90+
if repo_model.IsErrUnitTypeNotExist(err) {
91+
return false, false, nil
92+
}
9093
return false, false, err
9194
}
9295

0 commit comments

Comments
 (0)