Skip to content

Commit 4baa6d7

Browse files
alexanderrtaylorjetersen
authored andcommitted
Added condition for 403 HTTP Status (#274)
1 parent cbcf851 commit 4baa6d7

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/main/java/com/cloudbees/jenkins/plugins/bitbucket/client/BitbucketCloudApiClient.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -422,6 +422,10 @@ public boolean checkPathExists(@NonNull String branchOrHash, @NonNull String pat
422422
return true;
423423
} else if (HttpStatus.SC_NOT_FOUND == status) {
424424
return false;
425+
} else if (HttpStatus.SC_FORBIDDEN == status) {
426+
// Needs to skip over the branch if there are permissions issues but let you know in the logs
427+
LOGGER.log(Level.FINE, "You currently do not have permissions to pull from repo: {0} at branch {1}", new Object[]{repositoryName, branchOrHash});
428+
return false;
425429
} else {
426430
throw new IOException("Communication error for url: " + path + " status code: " + status);
427431
}

0 commit comments

Comments
 (0)