Azure / azure-storage-java

Microsoft Azure Storage Library for Java
https://docs.microsoft.com/en-us/java/api/overview/azure/storage
MIT License
190 stars 164 forks source link

getMetadata returns only nulls #589

Closed MichaelVonB closed 9 months ago

MichaelVonB commented 9 months ago

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

BlobStorage

Which version of the SDK was used?

azure-storage-blob-12.25.1

What problem was encountered?

We upload blob with metaData

BlobParallelUploadOptions options =
            new BlobParallelUploadOptions(byteArrayInputStream)
                .setRequestConditions(new BlobRequestConditions().setIfNoneMatch(Constants.HeaderConstants.ETAG_WILDCARD)) // sets overwrite files to false
                .setMetadata(Map.of("foo", "bar"))
                .setHeaders(jsonHeaders);

blobClient.uploadWithResponse(options, null, Context.NONE);

and query them later on essentially like this

BlobContainerClient blobContainerClient = blobServiceClient.getBlobContainerClient("my-blob-container-client");
List<Map<String, String>> metaDataList = blobContainerClient.listBlobs().stream()
            .map(BlobItem::getMetadata)
            .toList();

But this will be a List of nulls. However I can see in the azure portal that the meta data is filled.

Have you found a mitigation/solution?

This works but I would expect the other solution to work aswell

List<Map<String, String>> metaDataListFull = blobContainerClient.listBlobs().stream()
            .map(it -> blobContainerClient.getBlobClient(it.getName()))
            .map(it -> it.getProperties().getMetadata())
            .toList();
MichaelVonB commented 9 months ago

This was the wrong place. Created an issue at the right repo. See https://github.com/Azure/azure-sdk-for-java/issues/38913