Skip to content

azure.storage.blob.BlobClient.from_blob_url() parses incorrect blob name and container name #12563

@chrisyeh96

Description

@chrisyeh96
  • Package Name: azure-storage-blob
  • Package Version: 12.3.2
  • Operating System: Windows 10 Version 10.0.19041 Build 19041, running WSL 1
  • Python Version: 3.8.3

Describe the bug
azure.storage.blob.BlobClient.get_blob_properties() returns incorrect "name" and "container" properties

To Reproduce
Steps to reproduce the behavior:

Code

from azure.storage.blob import BlobClient

PUBLIC_BLOB_URI = 'https://lilablobssc.blob.core.windows.net/nacti-unzipped/part0/sub000/2010_Unit150_Ivan097_img0003.jpg'

blob_client = BlobClient.from_blob_url(PUBLIC_BLOB_URI)
properties = blob_client.get_blob_properties()
print(properties['name'])
print(properties['container'])

Running Code in Python REPL:

>>> from azure.storage.blob import BlobClient
>>>
>>> PUBLIC_BLOB_URI = 'https://lilablobssc.blob.core.windows.net/nacti-unzipped/part0/sub000/2010_Unit150_Ivan097_img0003.jpg'
>>>
>>> blob_client = BlobClient.from_blob_url(PUBLIC_BLOB_URI)
>>> properties = blob_client.get_blob_properties()
>>> print(properties['name'])
2010_Unit150_Ivan097_img0003.jpg
>>> print(properties['container'])
sub000

Expected behavior
A clear and concise description of what you expected to happen.

The blob name should be "part0/sub000/2010_Unit150_Ivan097_img0003.jpg" instead of "2010_Unit150_Ivan097_img0003.jpg" and the container should be "nacti-unzipped" instead of "sub000".

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)bugThis issue requires a change to an existing behavior in the product in order to be resolved.customer-reportedIssues that are reported by GitHub users external to the Azure organization.

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions