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

Fixes issue with AzureBlobStore blockid incorrectly using base64url encoding #208

Merged
merged 1 commit into from
Aug 4, 2024
Merged
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
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));
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The url encoding is handled downstream by org.jclouds.util.Strings2's urlEncode method.

}

@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
Loading