Skip to content

Commit 18e20c3

Browse files
joseblasbitwiseman
andauthored
no break a search when 401 is returned (#394)
Co-authored-by: Liam Newman <[email protected]>
1 parent 1e2c0c9 commit 18e20c3

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/main/java/com/cloudbees/jenkins/plugins/bitbucket/server/client/BitbucketServerAPIClient.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -510,7 +510,9 @@ public boolean checkPathExists(@NonNull String branchOrHash, @NonNull String pat
510510
int status = getRequestStatus(url);
511511
if (HttpStatus.SC_OK == status) {
512512
return true;
513-
} else if (HttpStatus.SC_NOT_FOUND == status) {
513+
// BitBucket return UNAUTHORIZED when no credentials are provided
514+
// https://support.atlassian.com/bitbucket-cloud/docs/use-bitbucket-rest-api-version-1/
515+
} else if (HttpStatus.SC_NOT_FOUND == status || HttpStatus.SC_UNAUTHORIZED == status) {
514516
return false;
515517
} else {
516518
throw new IOException("Communication error for url: " + path + " status code: " + status);

0 commit comments

Comments
 (0)