Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Requester pays to check reason and fallback to error message validation #841

Merged
merged 5 commits into from
Mar 4, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -967,7 +967,11 @@ public boolean requesterPays(String bucketName) {
Boolean isRP = storage.get(bucketName).requesterPays();
return isRP != null && isRP.booleanValue();
} catch (StorageException ex) {
if (ex.getCode() == 400 && ex.getMessage().contains("Bucket is requester pays")) {
if (ex.getReason().equals("userProjectMissing")) {
return true;
// fallback to checking the error code and error message.
} else if (ex.getCode() == 400
&& ex.getMessage().contains("Bucket is a requester pays bucket")) {
sydney-munro marked this conversation as resolved.
Show resolved Hide resolved
return true;
}
throw ex;
Expand Down