[BUG] Azure Storage BlobClient doesn't properly escape filenames with certain characters #11602
Labels
Client
This issue points to a problem in the data-plane of the library.
customer-reported
Issues that are reported by GitHub users external to the Azure organization.
question
The issue doesn't require a change to the product in order to be resolved. Most issues start as that
Service Attention
Workflow: This issue is responsible by Azure service team.
Storage
Storage Service (Queues, Blobs, Files)
Describe the bug
BlobClient doesn't properly escape filenames with certain characters such as '#'. This results in a time-consuming-to-debug exception.
Expected behavior
BlobClient constructor should automatically handle proper escaping of filenames. It took me a while to figure out a workaround. Simple Uri.EscapeUriString is insufficient, though Uri.EscapeDataString appears to work.
If this behavior is by design, then the constructor should at least throw an exception up front to warn users of invalid characters and/or the docs should be updated to explicitly state how the filename needs to be encoded.
Actual behavior (include Exception or Stack Trace)
Azure.RequestFailedException: 'Service request failed.
Status: 404 (The specified blob does not exist.)
ErrorCode: BlobNotFound
To Reproduce
Environment:
dotnet --info
output for .NET Core projects):.NET Core SDK (reflecting any global.json):
Version: 3.1.201
Commit: b1768b4ae7
Runtime Environment:
OS Name: Windows
OS Version: 10.0.18363
OS Platform: Windows
RID: win10-x64
Base Path: C:\Program Files\dotnet\sdk\3.1.201\
Host (useful for support):
Version: 3.1.3
Commit: 4a9f85e9f8
.NET Core SDKs installed:
1.1.14 [C:\Program Files\dotnet\sdk]
2.1.202 [C:\Program Files\dotnet\sdk]
2.1.500 [C:\Program Files\dotnet\sdk]
2.1.512 [C:\Program Files\dotnet\sdk]
2.1.801 [C:\Program Files\dotnet\sdk]
2.2.401 [C:\Program Files\dotnet\sdk]
3.1.201 [C:\Program Files\dotnet\sdk]
The text was updated successfully, but these errors were encountered: