Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 1 addition & 1 deletion azure/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
</parent>
<artifactId>azure</artifactId>
<properties>
<azure-storage-version>12.32.0</azure-storage-version>
<azure-storage-version>12.33.0</azure-storage-version>
</properties>

<dependencies>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,11 +141,12 @@ public StatusOutputStream<Void> write(final Path file, final TransferStatus stat
// Existing block blob type
final PathAttributes attr = new AzureAttributesFinderFeature(session).find(file);
if(BlobType.APPEND_BLOB == BlobType.valueOf(attr.getCustom().get(AzureAttributesFinderFeature.KEY_BLOB_TYPE))) {
out = client.getAppendBlobClient().getBlobOutputStream(true);
final AppendBlobClient append = client.getAppendBlobClient();
// No BlockBlobOutputStreamOptions
out = append.getBlobOutputStream(true);
}
else {
final BlockBlobOutputStreamOptions options = new BlockBlobOutputStreamOptions()
.setMetadata(metadata)
.setHeaders(headers)
.setMetadata(metadata);
out = client.getBlockBlobClient().getBlobOutputStream(options);
Expand All @@ -158,7 +159,6 @@ public StatusOutputStream<Void> write(final Path file, final TransferStatus stat
case APPEND_BLOB: {
final AppendBlobClient append = client.getAppendBlobClient();
final AppendBlobCreateOptions options = new AppendBlobCreateOptions()
.setMetadata(metadata)
.setHeaders(headers)
.setMetadata(metadata);
append.createWithResponse(options, null, null);
Expand All @@ -168,7 +168,6 @@ public StatusOutputStream<Void> write(final Path file, final TransferStatus stat
default: {
final BlockBlobClient block = client.getBlockBlobClient();
final BlockBlobOutputStreamOptions options = new BlockBlobOutputStreamOptions()
.setMetadata(metadata)
.setHeaders(headers)
.setMetadata(metadata);
out = block.getBlobOutputStream(options);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ public void testWriteOverrideAppendBlob() throws Exception {
// Test double close
overwrite.close();
assertEquals("overwrite".getBytes(StandardCharsets.UTF_8).length, new AzureAttributesFinderFeature(session).find(test).getSize());
final Map<String, String> appendMetadata = new AzureMetadataFeature(session).getMetadata(test);
assertEquals("text/plain", appendMetadata.get("Content-Type"));
new AzureDeleteFeature(session).delete(Collections.singletonList(test), new DisabledLoginCallback(), new Delete.DisabledCallback());
}

Expand Down Expand Up @@ -100,6 +102,8 @@ public void testWriteOverrideBlockBlob() throws Exception {
// Test double close
overwrite.close();
assertEquals("overwrite".getBytes(StandardCharsets.UTF_8).length, new AzureAttributesFinderFeature(session).find(test).getSize());
final Map<String, String> overwriteMetadata = new AzureMetadataFeature(session).getMetadata(test);
assertEquals("text/plain", overwriteMetadata.get("Content-Type"));
new AzureDeleteFeature(session).delete(Collections.singletonList(test), new DisabledLoginCallback(), new Delete.DisabledCallback());
}
}