Skip to content

Print out MD5, but get a byte array.  #13104

@likun47

Description

@likun47

-azure_storage_blob-12.3.2:

  • Azure SDK for Python:
  • Windows 10:
  • Python 3.0:

Describe the bug
I have a customer, she wrote some code wanted to get a MD5 content, it was supposed to return a string, but she got a byte array.

To Reproduce
Steps to reproduce the behavior:

  1. Running the code below:
    from azure.storage.blob import BlobServiceClient
    blob_service_client = BlobServiceClient.from_connection_string(connect_str);
    container_client = blob_service_client.get_container_client(container_name)
    blob_list = container_client.list_blobs(name_starts_with=src);
    for blob in blob_list:
    print( blob.name + "\t" + str(blob.content_settings.content_md5) )

Output:
quickstart.txt bytearray(b'\x93\x8f1xZ\xc2]\xc1\xcb\x1f\xd5\x10\xef .\x92')

Expected behavior
Return result should be a string: 'k48xeFrCXcHLH9UQ7yAukg==

Screenshots
N/A

Additional context
Background information from my customer:

from azure.storage.blob import BlockBlobService
block_blob_service = BlockBlobService(account_name=acct_name, account_key=acct_key)
blob_list = block_blob_service.list_blobs(container_name, src, include='metadata')
for blob in blob_list:
print blob.name + "\t" + blob.properties.content_settings.content_md5
The code above works well. But we upgraded our system to python 3 and some featuresare gone, for example, 'blob_tier' is not an attribute of Blobproperties under BlockBlobService.

That is the reason we changed to BlobServiceClient. Then I encountered ‘md5’ issue.

Metadata

Metadata

Assignees

Labels

ClientThis issue points to a problem in the data-plane of the library.Service AttentionWorkflow: This issue is responsible by Azure service team.StorageStorage Service (Queues, Blobs, Files)customer-reportedIssues that are reported by GitHub users external to the Azure organization.questionThe issue doesn't require a change to the product in order to be resolved. Most issues start as that

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions