Skip to content

Commit

Permalink
Fixes issue with AzureBlobStore blockid incorrectly using base64url e…
Browse files Browse the repository at this point in the history
…ncoding
  • Loading branch information
twickline authored and gaul committed Aug 4, 2024
1 parent ddfb2ea commit 6ef293d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -440,9 +440,10 @@ public String completeMultipartUpload(MultipartUpload mpu, List<MultipartPart> p
return sync.putBlockList(mpu.containerName(), azureBlob, blocks.build());
}

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

@Override
public MultipartPart uploadMultipartPart(MultipartUpload mpu, int partNumber, Payload payload) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
@Test(groups = "unit", testName = "AzureBlobStore")
public class AzureBlobStoreTest {

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

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

0 comments on commit 6ef293d

Please sign in to comment.