This repository is for active development of the Azure SDK for .NET. For consumers of the SDK we recommend visiting our public developer docs at https://learn.microsoft.com/dotnet/azure/ or our versioned developer docs at https://azure.github.io/azure-sdk-for-net.
MIT License
5.35k
stars
4.66k
forks
source link
[BUG] Blobs with names containing nameless virtual folders are not handled consistently in the SDK #45156
I have blobs where the name contains nameless directories like //somename/file.txt. When trying to read these I get different behaviors depending on that method I use.
Method 1:
var blobClient = blobContainerClient.GetBlobClient(blobItem.Name);
var tags = await blobClient.GetTagsAsync();
Method 2:
var blobClient = new BlobClient(connString, blobContainerClient.Name, blobItem.Name);
var tags = await blobClient.GetTagsAsync();
Method 3:
var blobUri = new Uri($"{blobContainerClient.Uri}/{blobItem.Name}");
var blobClient = new BlobClient(blobUri, new StorageSharedKeyCredential("account-name", "account-key"));
var tags = await blobClient.GetTagsAsync();
Library name and version
Azure.Storage.Blobs 12.21.0
Describe the bug
I have blobs where the name contains nameless directories like //somename/file.txt. When trying to read these I get different behaviors depending on that method I use.
Method 1:
Method 2:
Method 3:
See also stack overflow post here: Can not read blobs through BlobContainerClient for blobs with empty folder prefixes
Expected behavior
All methods should work and fetch the tags for the blob.
Actual behavior
Only method 3 work, the two other gives me a
RequestFailedException
. The resulting request paths are:Method 1: https://myaccount.blob.core.windows.net/mycontainer/somename/file.txt?comp=tags Method 2: https://myaccount.blob.core.windows.net/mycontainer/somename/file.txt?comp=tags Method 3: https://myaccount.blob.core.windows.net/mycontainer///somename/file.txt?comp=tags
Reproduction Steps
See code examples in description.
Environment
No response