Amber Liu created JCLOUDS-1612: ---------------------------------- Summary: Using Azure SAS Token unable to upload some parts of the file (blockid if "Not a valid base64 string") Key: JCLOUDS-1612 URL: https://issues.apache.org/jira/browse/JCLOUDS-1612 Project: jclouds Issue Type: Bug Components: jclouds-blobstore Affects Versions: 2.5.0 Environment: Windows 10 jdk1.8.0_281 Reporter: Amber Liu
I'm trying to [put block|https://docs.microsoft.com/en-us/rest/api/storageservices/put-block#request] with Azure SAS Token. However, it failed in some "specific" parts. Here is the error message: {code:java} 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.}'} {code} 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|https://github.com/apache/jclouds/blob/0b89ee0825d45de1193090cdd5efc5f1135fa200/providers/azureblob/src/main/java/org/jclouds/azureblob/blobstore/AzureBlobStore.java#L444-L450] to generate *blockid* {code:java} String blockId = BaseEncoding.base64().encode(Ints.toByteArray(partNumber)); {code} And my version of *guava* is 27.1-jre which is used in jclouds 2.5.0 {code:java} <dependency> <groupId>com.google.guava</groupId> <artifactId>guava</artifactId> <version>27.1-jre</version> </dependency> {code} 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! -- This message was sent by Atlassian Jira (v8.20.10#820010)