-
Notifications
You must be signed in to change notification settings - Fork 3.3k
Description
- 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
- 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.