Uploaded image for project: 'jclouds'
  1. jclouds
  2. JCLOUDS-1612

Using Azure SAS Token unable to upload some parts of the file (blockid if "Not a valid base64 string")

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Duplicate
    • 2.5.0
    • None
    • jclouds-blobstore
    • Windows 10
      jdk1.8.0_281

    Description

      I'm trying to put block with Azure SAS Token.

      However, it failed in some "specific" parts.

      Here is the error message:

      org.jclouds.azure.storage.AzureStorageResponseException: command [method=org.jclouds.azureblob.AzureBlobClient.public abstract void org.jclouds.azureblob.AzureBlobClient.putBlock(java.lang.String,java.lang.String,java.lang.String,org.jclouds.io.Payload)[azure-auto-123, sub2/100MBFile, AAV+QA==, [content=true, contentMetadata=[cacheControl=null, contentDisposition=null, contentEncoding=null, contentLanguage=null, contentLength=1048576, contentMD5=null, contentType=application/unknown, expires=null], written=false, isSensitive=false]], request=PUT https://casbazure.blob.core.windows.net/azure-auto-123/sub2/100MBFile?comp=block&blockid=AAV%2BQA%3D%3D HTTP/1.1] failed with code 400, error: AzureError{requestId='5b9a2f41-301e-008d-4e5b-97e57d000000', code='InvalidQueryParameterValue', message='Value for one of the query parameters specified in the request URI is invalid.
      RequestId:5b9a2f41-301e-008d-4e5b-97e57d000000
      Time:2022-07-14T08:24:41.1097266Z', context='{QueryParameterValue=AAV QA==, QueryParameterName=blockid, Reason=Not a valid base64 string.}'} 

      As you can see, the blockid becomes "AAV QA==" which is a invalid base64 string.

       

      My Observation

      I checked the failed parts and they all have "+" in their blockid.

      For example, from part 1 to part 500, the following parts have "+" in their blockid  :

       

      Part Number blockid
      248 AAAA+A==
      249 AAAA+Q==
      250 AAAA+g==
      251 AAAA+w==

       

      I used the same code in here to generate blockid

      String blockId = BaseEncoding.base64().encode(Ints.toByteArray(partNumber)); 

       

      And my version of guava is 27.1-jre which is used in jclouds 2.5.0

      <dependency>
          <groupId>com.google.guava</groupId>
          <artifactId>guava</artifactId>
          <version>27.1-jre</version>
      </dependency> 

       

      By the way, it works fine with Azure account name and account key.

      I can successfully upload all parts. 

      (I think the blockid still has "+" but I don't know why it works with Azure account name and account key)

       

      Please help me to fix this problem. Thank you!

      Attachments

        Activity

          People

            Unassigned Unassigned
            joy45689 Amber Liu
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: