Skip to content

Commit 15b61da

Browse files
authored
Prevent 500 is head repo does not have PullRequest unit in IsUserAllowedToUpdate (#20839) (#20848)
Backport #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 #20621 Signed-off-by: Andrew Thornton <[email protected]> Signed-off-by: Andrew Thornton <[email protected]>
1 parent 35ca651 commit 15b61da

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)