You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jclouds.apache.org by ga...@apache.org on 2024/08/04 06:27:35 UTC

(jclouds) branch master updated: Fixes issue with AzureBlobStore blockid incorrectly using base64url encoding

This is an automated email from the ASF dual-hosted git repository.

gaul pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/jclouds.git


The following commit(s) were added to refs/heads/master by this push:
     new 6ef293dfd3 Fixes issue with AzureBlobStore blockid incorrectly using base64url encoding
6ef293dfd3 is described below

commit 6ef293dfd34f2af0ef45bacd04247c3e8afe0261
Author: twickline <tw...@axon.com>
AuthorDate: Fri Aug 2 13:35:56 2024 -0700

    Fixes issue with AzureBlobStore blockid incorrectly using base64url encoding
---
 .../main/java/org/jclouds/azureblob/blobstore/AzureBlobStore.java  | 7 ++++---
 .../java/org/jclouds/azureblob/blobstore/AzureBlobStoreTest.java   | 2 +-
 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/providers/azureblob/src/main/java/org/jclouds/azureblob/blobstore/AzureBlobStore.java b/providers/azureblob/src/main/java/org/jclouds/azureblob/blobstore/AzureBlobStore.java
index 75e9998117..147ce0cc9b 100644
--- a/providers/azureblob/src/main/java/org/jclouds/azureblob/blobstore/AzureBlobStore.java
+++ b/providers/azureblob/src/main/java/org/jclouds/azureblob/blobstore/AzureBlobStore.java
@@ -440,9 +440,10 @@ public class AzureBlobStore extends BaseBlobStore {
       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) {
diff --git a/providers/azureblob/src/test/java/org/jclouds/azureblob/blobstore/AzureBlobStoreTest.java b/providers/azureblob/src/test/java/org/jclouds/azureblob/blobstore/AzureBlobStoreTest.java
index 71830151cd..ab4885f29d 100644
--- a/providers/azureblob/src/test/java/org/jclouds/azureblob/blobstore/AzureBlobStoreTest.java
+++ b/providers/azureblob/src/test/java/org/jclouds/azureblob/blobstore/AzureBlobStoreTest.java
@@ -28,7 +28,7 @@ import java.util.regex.Pattern;
 @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?