Skip to content
This repository was archived by the owner on Aug 6, 2025. It is now read-only.

Commit 6ef293d

Browse files
twicklinegaul
authored andcommitted
Fixes issue with AzureBlobStore blockid incorrectly using base64url encoding
1 parent ddfb2ea commit 6ef293d

2 files changed

Lines changed: 5 additions & 4 deletions

File tree

providers/azureblob/src/main/java/org/jclouds/azureblob/blobstore/AzureBlobStore.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -440,9 +440,10 @@ public String completeMultipartUpload(MultipartUpload mpu, List<MultipartPart> p
440440
return sync.putBlockList(mpu.containerName(), azureBlob, blocks.build());
441441
}
442442

443-
static String makeBlockId(int partNumber) {
444-
return BaseEncoding.base64Url().encode(Ints.toByteArray(partNumber));
445-
}
443+
static String makeBlockId(int partNumber) {
444+
// Azure expects a base64-encoded string ONLY. It does not support base64url encoding.
445+
return BaseEncoding.base64().encode(Ints.toByteArray(partNumber));
446+
}
446447

447448
@Override
448449
public MultipartPart uploadMultipartPart(MultipartUpload mpu, int partNumber, Payload payload) {

providers/azureblob/src/test/java/org/jclouds/azureblob/blobstore/AzureBlobStoreTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
@Test(groups = "unit", testName = "AzureBlobStore")
2929
public class AzureBlobStoreTest {
3030

31-
private static final Pattern VALIDATION_PATTERN = Pattern.compile("[a-zA-Z0-9\\-_=]*");
31+
private static final Pattern VALIDATION_PATTERN = Pattern.compile("^[a-zA-Z0-9+/=]*$");
3232

3333
public void testMakeBlockId() {
3434
// how can i achieve something like a junit5 parametrized test in testng?

0 commit comments

Comments
 (0)