Skip to content

Commit 59027c3

Browse files
zeripathlunnylafriks
authored and
Sysoev, Vladimir
committed
Prevent 500 is head repo does not have PullRequest unit in IsUserAllowedToUpdate (go-gitea#20839)
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]> Signed-off-by: Andrew Thornton <[email protected]> Co-authored-by: Lunny Xiao <[email protected]> Co-authored-by: Lauris BH <[email protected]>
1 parent 555b828 commit 59027c3

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)