diff options
author | zeripath <art27@cantab.net> | 2022-08-18 11:31:15 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-08-18 13:31:15 +0300 |
commit | 0724ca451edb6cc1c56667716ea7ea83831ddeef (patch) | |
tree | 4526bc032e9fc33010302d5e7a1e3edf75fb6764 /services/pull | |
parent | 999392f6a5cfa450148cbcb42a17d3f7dcfd1ec7 (diff) | |
download | gitea-0724ca451edb6cc1c56667716ea7ea83831ddeef.tar.gz gitea-0724ca451edb6cc1c56667716ea7ea83831ddeef.zip |
Prevent 500 is head repo does not have PullRequest unit in IsUserAllowedToUpdate (#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 #20621
Signed-off-by: Andrew Thornton <art27@cantab.net>
Signed-off-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: Lauris BH <lauris@nix.lv>
Diffstat (limited to 'services/pull')
-rw-r--r-- | services/pull/update.go | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/services/pull/update.go b/services/pull/update.go index e5e26462e5..49258a9862 100644 --- a/services/pull/update.go +++ b/services/pull/update.go @@ -87,6 +87,9 @@ func IsUserAllowedToUpdate(ctx context.Context, pull *issues_model.PullRequest, } headRepoPerm, err := access_model.GetUserRepoPermission(ctx, pull.HeadRepo, user) if err != nil { + if repo_model.IsErrUnitTypeNotExist(err) { + return false, false, nil + } return false, false, err } |