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

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

Closed
chrisyeh96 opened this issue Jul 15, 2020 · 5 comments
Assignees
Labels
bug This issue requires a change to an existing behavior in the product in order to be resolved. 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. Service Attention Workflow: This issue is responsible by Azure service team. Storage Storage Service (Queues, Blobs, Files)
Milestone

Comments

@chrisyeh96
Copy link
Contributor

  • 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".

@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 Jul 15, 2020
@chrisyeh96 chrisyeh96 changed the title azure.storage.blob.BlobClient.get_blob_properties() returns incorrect "name" and "container" properties azure.storage.blob.BlobClient.from_blob_url() parses incorrect blob name and container name Jul 16, 2020
@chrisyeh96
Copy link
Contributor Author

chrisyeh96 commented Jul 16, 2020

Update: the issue is actually in azure.storage.blob.BlobClient.from_blob_url(), so I updated the issue title to match.

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)
print(blob_client.blob_name)
print(blob_client.container_name)

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)
>>> print(blob_client.blob_name)
'2010_Unit150_Ivan097_img0003.jpg'
>>> print(blob_client.container_name)
'sub000'

@kaerm kaerm added Client This issue points to a problem in the data-plane of the library. Service Attention Workflow: This issue is responsible by Azure service team. Storage Storage Service (Queues, Blobs, Files) labels Jul 16, 2020
@ghost ghost removed the needs-triage Workflow: This is a new issue that needs to be triaged to the appropriate team. label Jul 16, 2020
@ghost
Copy link

ghost commented Jul 16, 2020

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

@lmazuel lmazuel added this to the Backlog milestone Jul 16, 2020
@xiafu-msft
Copy link
Contributor

Hi @chrisyeh96

Thanks for reporting this and post that pr. It's the SDKs problem with parsing blob url with sub directories! Sorry for the inconvenience.

@xiafu-msft xiafu-msft added bug This issue requires a change to an existing behavior in the product in order to be resolved. and removed question The issue doesn't require a change to the product in order to be resolved. Most issues start as that labels Jul 20, 2020
@xiafu-msft
Copy link
Contributor

the fix has been released, you can do pip install azure-storage-blob==12.4.0 to use it.

@chrisyeh96
Copy link
Contributor Author

Thanks @xiafu-msft! The fix seems to work. Closing this issue.

openapi-sdkautomation bot pushed a commit to AzureSDKAutomation/azure-sdk-for-python that referenced this issue Jan 25, 2021
openapi-sdkautomation bot pushed a commit to AzureSDKAutomation/azure-sdk-for-python that referenced this issue Jan 25, 2021
00Kai0 added a commit that referenced this issue Jan 29, 2021
* CodeGen from PR 12563 in Azure/azure-rest-api-specs
Enable python track2 pipeline (#12563)

* test,version,CHANGELOG

* fix test

* fix changelog

Co-authored-by: SDKAuto <sdkautomation@microsoft.com>
00Kai0 added a commit that referenced this issue Jan 29, 2021
* CodeGen from PR 12563 in Azure/azure-rest-api-specs
Enable python track2 pipeline (#12563)

* test,version,CHANGELOG

* fix test

* fix changelog , version

Co-authored-by: SDKAuto <sdkautomation@microsoft.com>
@github-actions github-actions bot locked and limited conversation to collaborators Apr 12, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug This issue requires a change to an existing behavior in the product in order to be resolved. 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. Service Attention Workflow: This issue is responsible by Azure service team. Storage Storage Service (Queues, Blobs, Files)
Projects
None yet
Development

No branches or pull requests

4 participants