[BUG] Azure batch delete blobs fails if blob contains cyrillic characters
See original GitHub issueDescribe the bug
Consider the following blob name which is uploaded successfully to Azure - здраве-и-красота-от-природатаjpg–xfgqfvhj.axp.jpg
Deleting it using BlobBatchClient.DeleteBlobsAsync
returns Azure.RequestFailedException
and blobs are not deleted.
Deleting other blobs having the same name structure but containing only latin characters are deleted successfully.
Expected behavior Delete selected blobs.
Actual behavior An exception is thrown:
Azure.RequestFailedException: Invalid response Status: 202 (Accepted)
Headers: Transfer-Encoding: chunked Server: Windows-Azure-Blob/1.0,Microsoft-HTTPAPI/2.0 x-ms-request-id: ca75dfea-301e-0037-034f-797a43000000 x-ms-version: 2020-08-04 x-ms-client-request-id: 92f5a687-8b59-4782-afff-8cd7f89b0ca3 Date: Thu, 15 Jul 2021 08:01:05 GMT Content-Type: multipart/mixed; boundary=batchresponse_34a11e24-f92f-4988-95fe-d61c91ab93c2
—> System.InvalidOperationException: Expected 2 responses for the batch request, not 1.
at Azure.Storage.Blobs.Specialized.BlobBatchClient.UpdateOperationResponses(IList1 messages, Response rawResponse, Stream responseContent, String responseContentType, Boolean throwOnAnyFailure, Boolean async, CancellationToken cancellationToken) --- End of inner exception stack trace --- at Azure.Storage.Blobs.Specialized.BlobBatchClient.UpdateOperationResponses(IList
1 messages, Response rawResponse, Stream responseContent, String responseContentType, Boolean throwOnAnyFailure, Boolean async, CancellationToken cancellationToken)
at Azure.Storage.Blobs.Specialized.BlobBatchClient.SubmitBatchInternal(BlobBatch batch, Boolean throwOnAnyFailure, Boolean async, CancellationToken cancellationToken)
at Azure.Storage.Blobs.Specialized.BlobBatchClient.DeleteBlobsInteral(IEnumerable1 blobUris, DeleteSnapshotsOption snapshotsOption, Boolean async, CancellationToken cancellationToken) at Azure.Storage.Blobs.Specialized.BlobBatchClient.DeleteBlobsAsync(IEnumerable
1 blobUris, DeleteSnapshotsOption snapshotsOption, CancellationToken cancellationToken)
at Smartalize.Web.Services.Implementations.StorageService.UnAssociateProductMedia(IEnumerable1 oldEntities, IEnumerable
1 currentEntities, BlobBatchClient batchClient, BlobContainerClient container) in
To Reproduce
- Create a file with name - здраве-и-красота-от-природатаjpg–xfgqfvhj.axp.jpg
- Upload it to an Azure container
- Try to delete it using
BlobBatchClient.DeleteBlobsAsync(IEnumerable<Uri>, DeleteSnapshotsOption, CancellationToken)
method
Environment:
- Azure.Storage.Blobs 12.9.1, Azure.Storage.Blobs.Batch 12.9.1
- .NET SDK (reflecting any global.json): Version: 5.0.302 Commit: c005824e35
Runtime Environment: OS Name: Windows OS Version: 10.0.19043 OS Platform: Windows RID: win10-x64 Base Path: C:\Program Files\dotnet\sdk\5.0.302\
Host (useful for support): Version: 5.0.8 Commit: 35964c9215
- Visual Studio 16.10.3
Issue Analytics
- State:
- Created 2 years ago
- Comments:7 (1 by maintainers)
Top GitHub Comments
@intenzive - I too think so. Considering the REST API accepts only container name and blob name, SDK should provide an override to specify string instead of URI.
I posted an answer on your
Stack Overflow
question as well. Pasting the same answer here for completeness.