BlobClient.from_blob_url() invalid URL if host is localhost/127.0.0.1 #15882
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)
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
andblob_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
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.
The text was updated successfully, but these errors were encountered: