Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] When blob contains no metadata then BlobItem.Metadata is null even if BlobTraits.Metadata was specified #14750

Closed
romanskrabis opened this issue Sep 1, 2020 · 3 comments · Fixed by #14861
Assignees
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. needs-team-attention Workflow: This issue needs attention from Azure service team or SDK team 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)

Comments

@romanskrabis
Copy link

Describe the bug
When blob contains no metadata then BlobItem.Metadata is null even if BlobTraits.Metadata was specified for versions 12.5.1 or 12.6.0

Expected behavior
Metadata should be a dictionary with no items

Actual behavior (include Exception or Stack Trace)
Metadata is null

To Reproduce

        string connectionString = "";
        string containerName = "test-container";
        string blobName1 = "blob1";
        string blobName2 = "blob2";
        Dictionary<string, string> metadata1 = new Dictionary<string, string> { { "key", "value" } };
        Dictionary<string, string> metadata2 = new Dictionary<string, string> { };

        BlobContainerClient blobContainerClient = new BlobContainerClient(connectionString, containerName);
        blobContainerClient.CreateIfNotExists();

        BlockBlobClient blobClient1 = new BlockBlobClient(connectionString, containerName, blobName1);
        using (MemoryStream memoryStream1 = new MemoryStream(Encoding.ASCII.GetBytes("test")))
            blobClient1.Upload(memoryStream1, null, metadata1);

        BlockBlobClient blobClient2 = new BlockBlobClient(connectionString, containerName, blobName2);
        using (MemoryStream memoryStream2 = new MemoryStream(Encoding.ASCII.GetBytes("test")))
            blobClient2.Upload(memoryStream2, null, metadata2);


        Pageable<BlobItem> blobs = blobContainerClient.GetBlobs(BlobTraits.Metadata);
        BlobItem blob1 = blobs.FirstOrDefault(item => item.Name == blobName1);
        BlobItem blob2 = blobs.FirstOrDefault(item => item.Name == blobName2);

        // blob1.Metadata.Count is 1
        Console.WriteLine(blob1.Metadata?.Count);
        // blob2.Metadata.Count is 0 for Azure.Storage.Blobs version="12.4.4"
        // blob2.Metadata is null for Azure.Storage.Blobs version="12.5.1"
        Console.WriteLine(blob2.Metadata?.Count);

Environment:

  • Worked as expected for Azure.Storage.Blobs version="12.4.4"
  • Returns null for Azure.Storage.Blobs version="12.5.1"
@ghost ghost added needs-triage Workflow: This is a new issue that needs to be triaged to the appropriate team. 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 labels Sep 1, 2020
@jsquire jsquire added Client This issue points to a problem in the data-plane of the library. needs-team-attention Workflow: This issue needs attention from Azure service team or SDK team Service Attention Workflow: This issue is responsible by Azure service team. Storage Storage Service (Queues, Blobs, Files) labels Sep 1, 2020
@ghost ghost removed the needs-triage Workflow: This is a new issue that needs to be triaged to the appropriate team. label Sep 1, 2020
@jsquire
Copy link
Member

jsquire commented Sep 1, 2020

Thank you for your feedback. Tagging and routing to the team best able to assist.

@ghost
Copy link

ghost commented Sep 1, 2020

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @xgithubtriage.

@seanmcc-msft seanmcc-msft self-assigned this Sep 2, 2020
@seanmcc-msft
Copy link
Member

Hi @romisak, thanks for the detailed bug report. I'll look into getting this fixed in our next release.

-Sean

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
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. needs-team-attention Workflow: This issue needs attention from Azure service team or SDK team 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)
Projects
None yet
3 participants