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

BlobClient.from_blob_url() invalid URL if host is localhost/127.0.0.1 #15882

Closed
phergo opened this issue Dec 20, 2020 · 2 comments
Closed

BlobClient.from_blob_url() invalid URL if host is localhost/127.0.0.1 #15882

phergo opened this issue Dec 20, 2020 · 2 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. needs-author-feedback Workflow: More information is needed from author to address the issue. Storage Storage Service (Queues, Blobs, Files)

Comments

@phergo
Copy link

phergo commented Dec 20, 2020

  • Package Name: azure.storage.blob
  • Package Version: 12.6.0 (also seen on 12.4.0 and 12.5.0; no issue on 12.3.0)
  • Operating System: macOS High Sierra 10.13.6
  • Python Version: 3.8.5 (also tested in 3.7.4)

Describe the bug
When instantiating a BlobClient object through .from_blob_url() method using a localhost/127.0.0.1 address, the resulting object's url attribute is different to the specified URL; specifically, the URL attribute is missing a slash between the host (with or without TCP port) and the storage account name. The incorrect URL means methods such as .download_blob() does not work.

For example, if a BlobClient object is created as:
bc = BlobClient.from_blob_url('http://127.0.0.1:10000/devstoreaccount1/container1/folder1/file.csv')

The resulting bc.url attribute is incorrectly reported as below (note the missing slash right after 127.0.0.1:10000):
http://127.0.0.1:10000devstoreaccount1/container1/folder1/file.csv

Even though the full URL is not valid, both container_name and blob_name are correctly parsed from the URL, as 'container1' and 'folder1/file.csv' respectively.

The same behavior has been seen in azure.storage.blob package versions 12.4.0, 12.5.0 and 12.6.0; however, the result is correct in 12.3.0. The same results were obtained in python 3.7.4 and 3.8.5.

The results seem to be correct, though, with any server name/address other than localhost or 127.0.0.1.

To Reproduce

  1. Simple fully working test script (credentials and other non-relevant items ignored):
    from azure.storage.blob import BlobClient
    url = 'http://127.0.0.1:10000/devstoreaccount1/container1/folder1/file.csv'
    bc = BlobClient.from_blob_url(blob_url=url)
    assert url == bc.url
    

Expected behavior
The BlobClient url attribute should be the same as the url provided as argument to the .from_blob_url() method.

Screenshots
N/A

Additional context
Developing/Testing locally using VSCode (1.52.1) with Azurite (3.10.0) extension.

@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 Dec 20, 2020
@xiangyan99 xiangyan99 added Client This issue points to a problem in the data-plane of the library. Storage Storage Service (Queues, Blobs, Files) labels Jan 4, 2021
@ghost ghost removed the needs-triage Workflow: This is a new issue that needs to be triaged to the appropriate team. label Jan 4, 2021
@xiafu-msft
Copy link
Contributor

xiafu-msft commented Jan 5, 2021

Hi @phergo

Thanks for reporting this issue, we have a pr open to fix this.
If it's urgent feel free to install the .whl file by doing the following command after unzip it
pip install azure_storage_blob-12.6.1-py2.py3-none-any.whl

azure_storage_blob-12.6.1-py2.py3-none-any.zip

@xiafu-msft xiafu-msft added bug This issue requires a change to an existing behavior in the product in order to be resolved. needs-author-feedback Workflow: More information is needed from author to address the issue. and removed question The issue doesn't require a change to the product in order to be resolved. Most issues start as that labels Jan 5, 2021
@phergo
Copy link
Author

phergo commented Jan 5, 2021

Hi @xiafu-msft,

Many thanks! v12.6.1 renders the correct result in my local development environment. I consider this issue solved.

@phergo phergo closed this as completed Jan 5, 2021
@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. needs-author-feedback Workflow: More information is needed from author to address the issue. Storage Storage Service (Queues, Blobs, Files)
Projects
None yet
Development

No branches or pull requests

3 participants