Azure Blob Storage's ListBlobsSegmentedAsync method doesn't return metadata if metadata value is empty

Viewed 295

Calling ListBlobsSegmentedAsync method of Microsoft.Azure.Storage.Blob's (11.1.2) CloudBlobContainer attaches the blob metadata if BlobListingDetails.Metadata parameter (3rd) is set. However if blob metadata's value is empty, the metadata is not returned at all.

In turn, the metadata with empty value is displayed in the Storage Explorer.

BlobResultSegment blobList = await container.ListBlobsSegmentedAsync(blobPath, true, BlobListingDetails.Metadata, null, continuationToken, null, null);
                
foreach (CloudBlockBlob blobItem in blobList.Results)
{
  // trying to access blobItem's metadata
}

Edit: It seems it's not possible to create metadata with empty value through Azure Storage Blob's API (throws ArgumentException). However with Storage Emulator it's possible. enter image description here

I need to upload blobs containing metadata with empty ("" or null) value, is it possible somehow?

Edit 2: The feature is working with Azure.Storage.Blobs v.12.8.3. I'm using Microsoft.Azure.Storage.Blob v11.1.2. So the question applies to this library!

1 Answers

Using Azure.Storage.Blobs v12.8.3 works for the scenario that adding/retrieving metadata with an empty value.

UPDATE

This is the step that I tried to add metadata with empty value by REST API:

enter image description here

Result:

Though I leave metadata value as empty,to check its result on Azure Portal, it is set as null :

enter image description here

I also tried to remove all characters in textbox, but it is not allowed to update: enter image description here

Related