Skip to content

Commit

Permalink
Handle invalid MD5 hashes
Browse files Browse the repository at this point in the history
References #606.
  • Loading branch information
gaul committed Nov 10, 2024
1 parent 2e05eee commit b02ce67
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions src/main/java/org/gaul/s3proxy/azureblob/AzureBlobStore.java
Original file line number Diff line number Diff line change
Expand Up @@ -418,9 +418,21 @@ public String putBlob(String container, Blob blob, PutOptions options) {
} catch (IOException ioe) {
var cause = ioe.getCause();
if (cause != null && cause instanceof BlobStorageException) {
if (((BlobStorageException) cause).getErrorCode() ==
BlobErrorCode.CONTAINER_NOT_FOUND) {
var bse = (BlobStorageException) cause;
if (bse.getErrorCode() == BlobErrorCode.CONTAINER_NOT_FOUND) {
throw new ContainerNotFoundException(container, "");
} else if (bse.getErrorCode() ==
BlobErrorCode.INVALID_OPERATION) {
var response =
HttpResponse.builder().statusCode(400).build();
var exception = new HttpResponseException(
new HttpCommand(HttpRequest.builder()
.method("GET")
.endpoint("http://stub")
.build()),
response);
exception.initCause(bse);
throw exception;
}
}
throw new RuntimeException(ioe);
Expand Down

0 comments on commit b02ce67

Please sign in to comment.