[BUG] BlobClient Name is getting URL Encoded
See original GitHub issueDescribe the bug
If the blob.Name contains “/” like in a hierarchical structure, in the BlobClient, the name is escaped to %2F for the slashes. This passes through in the blobClient.Uri, which returns https://<accountname>.blob.core.windows.net/<containername>/blobroot%2Fsubfolder%2Fblobname.ext
as an example.
This works in some browsers still, but if the URL is URL Encoded, which it should be able to, it then breaks because the % symbols causes issues with future URL encoding where they get converted into %25, plus the 2F, turns in to %252F.
Expected behavior If the blob.Name has “/” then it should stay as “/” and not be escaped to %2F
Actual behavior (include Exception or Stack Trace) Blob name passed in as “blobroot/subfolder/blobname.ext” is converted to “blobroot%2Fsubfolder%2Fblobname.ext”
To Reproduce Steps to reproduce the behavior (include a code snippet, screenshot, or any additional information that might help us reproduce the issue)
- Create a BlobClient with a hierarchical name containing at least one subfolder.
- Then look at the blobClient.Uri and you will see that the blob Name has been escaped.
Environment:
- Azure.Storage.Blobs 12.6.0
- .NET Core 2.2
- Visual Studio 2019
Issue Analytics
- State:
- Created 3 years ago
- Reactions:2
- Comments:8 (4 by maintainers)
Top GitHub Comments
I can get the name by using
blobClient.Name
but then I have to do some string manipulation to get the full URI. If the service considers them the same, then I don’t see why it can’t return unescaped and let me decide whether it should be escaped or not. If nothing else then it should be consistent in the way in which it returns them.The service considers “/“ and “%20” to be the same character. In addition, you can get the unescaped blob name with BlobClient.Name.