Azure / azure-storage-net

Microsoft Azure Storage Libraries for .NET

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

BlobClient chop off the name when the blob name contains #

kyaw-sint opened this issue · comments

Which service(blob, file, queue, table) does this issue concern?

BlobClient service to read the blob.

Which version of the SDK was used?

Azure.Storage.Blobs - Version="12.10.0-beta.2"

Which platform are you using? (ex: .NET Core 2.1)

.NET Core 3.1

What problem was encountered?

blobClient.ExistsAsync() return false when reading the blob if the blob name contains # character even though the blob is there physically. I noticed that blobClient.Name was chop if the blob name contains #. So, it can be the issue that causing blob not found since the blob name in the blobClient is already wrong.
E.g. Original blob name "2f00c93f-1cfb-4586-a89b-9eb80314a8bc_TEST # for UPLOAD.pdf". blobClient.Name showed "2f00c93f-1cfb-4586-a89b-9eb80314a8bc_TEST " after creating BlobClient instance which is chopped off before #.

How can we reproduce the problem in the simplest way?

You can use the blob name which contains # and create BlobClient with managed identity and try to read the blob from the blob storage.

// Construct the blob container endpoint from the arguments.
string containerEndpoint = string.Format("https://{0}.blob.core.windows.net/{1}/{2}", accountName, containerName, blobName);

// Get a credential and create a service client object for the blob container.
BlobClient blobClient = new BlobClient(new Uri(containerEndpoint), new DefaultAzureCredential());

https://docs.microsoft.com/en-us/azure/storage/blobs/authorize-managed-identity

Have you found a mitigation/solution?

No.