Potential fix for URL parsing bugs in BlobClient.from_blob_url() #12567
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request proposes a fix for issue #12563
Consider a blob URL:
'https://lilablobssc.blob.core.windows.net/nacti-unzipped/part0/sub000/2010_Unit150_Ivan097_img0003.jpg'
Before this fix,
from_blob_url()
would incorrectly parse'2010_Unit150_Ivan097_img0003.jpg'
'sub000'
This fix correctly parses the url as
'part0/sub000/2010_Unit150_Ivan097_img0003.jpg'
'nacti-unzipped'
However, I believe my "fix" might be incomplete. In particular, it may not work for Azure Blob Storage accounts hosted on custom endpoints. As I was unable to find adequate documentation on how custom endpoints should be parsed, I did not consider this case. See the existing unit test here: https://github.com/Azure/azure-sdk-for-python/blob/master/sdk/storage/azure-storage-blob/tests/test_blob_client.py#L432-L439