diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/_blob_client.py b/sdk/storage/azure-storage-blob/azure/storage/blob/_blob_client.py
index 85837199921b..db4273e7ee3a 100644
--- a/sdk/storage/azure-storage-blob/azure/storage/blob/_blob_client.py
+++ b/sdk/storage/azure-storage-blob/azure/storage/blob/_blob_client.py
@@ -183,12 +183,10 @@ def _encode_source_url(self, source_url):
source_hostname = parsed_source_url.netloc.rstrip('/')
source_path = unquote(parsed_source_url.path)
source_query = parsed_source_url.query
- return "{}://{}{}?{}".format(
- source_scheme,
- source_hostname,
- quote(source_path, safe='~/'),
- source_query
- )
+ result = ["{}://{}{}".format(source_scheme, source_hostname, quote(source_path, safe='~/'))]
+ if source_query:
+ result.append(source_query)
+ return '?'.join(result)
@classmethod
def from_blob_url(cls, blob_url, credential=None, snapshot=None, **kwargs):
diff --git a/sdk/storage/azure-storage-blob/tests/recordings/test_container.test_list_blobs_with_include_copy.yaml b/sdk/storage/azure-storage-blob/tests/recordings/test_container.test_list_blobs_with_include_copy.yaml
index 72f457ba1247..8cc086e135fe 100644
--- a/sdk/storage/azure-storage-blob/tests/recordings/test_container.test_list_blobs_with_include_copy.yaml
+++ b/sdk/storage/azure-storage-blob/tests/recordings/test_container.test_list_blobs_with_include_copy.yaml
@@ -11,11 +11,11 @@ interactions:
Content-Length:
- '0'
User-Agent:
- - azsdk-python-storage-blob/12.0.0b5 Python/3.6.3 (Windows-10-10.0.18362-SP0)
+ - azsdk-python-storage-blob/12.4.0 Python/3.8.5 (Windows-10-10.0.18362-SP0)
x-ms-date:
- - Fri, 25 Oct 2019 17:59:37 GMT
+ - Wed, 02 Sep 2020 21:55:35 GMT
x-ms-version:
- - '2019-02-02'
+ - '2019-12-12'
method: PUT
uri: https://storagename.blob.core.windows.net/containere54813d5?restype=container
response:
@@ -25,15 +25,15 @@ interactions:
content-length:
- '0'
date:
- - Fri, 25 Oct 2019 17:59:36 GMT
+ - Wed, 02 Sep 2020 21:55:35 GMT
etag:
- - '"0x8D75975197B6CE2"'
+ - '"0x8D84F8AEC32E712"'
last-modified:
- - Fri, 25 Oct 2019 17:59:36 GMT
+ - Wed, 02 Sep 2020 21:55:35 GMT
server:
- Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0
x-ms-version:
- - '2019-02-02'
+ - '2019-12-12'
status:
code: 201
message: Created
@@ -53,15 +53,15 @@ interactions:
If-None-Match:
- '*'
User-Agent:
- - azsdk-python-storage-blob/12.0.0b5 Python/3.6.3 (Windows-10-10.0.18362-SP0)
+ - azsdk-python-storage-blob/12.4.0 Python/3.8.5 (Windows-10-10.0.18362-SP0)
x-ms-blob-type:
- BlockBlob
x-ms-date:
- - Fri, 25 Oct 2019 17:59:37 GMT
+ - Wed, 02 Sep 2020 21:55:36 GMT
x-ms-meta-status:
- original
x-ms-version:
- - '2019-02-02'
+ - '2019-12-12'
method: PUT
uri: https://storagename.blob.core.windows.net/containere54813d5/blob1
response:
@@ -73,11 +73,11 @@ interactions:
content-md5:
- XrY7u+Ae7tCTyyK7j1rNww==
date:
- - Fri, 25 Oct 2019 17:59:36 GMT
+ - Wed, 02 Sep 2020 21:55:35 GMT
etag:
- - '"0x8D759751984C5A7"'
+ - '"0x8D84F8AEC5020DC"'
last-modified:
- - Fri, 25 Oct 2019 17:59:37 GMT
+ - Wed, 02 Sep 2020 21:55:36 GMT
server:
- Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0
x-ms-content-crc64:
@@ -85,7 +85,9 @@ interactions:
x-ms-request-server-encrypted:
- 'true'
x-ms-version:
- - '2019-02-02'
+ - '2019-12-12'
+ x-ms-version-id:
+ - '2020-09-02T21:55:36.1680604Z'
status:
code: 201
message: Created
@@ -101,15 +103,15 @@ interactions:
Content-Length:
- '0'
User-Agent:
- - azsdk-python-storage-blob/12.0.0b5 Python/3.6.3 (Windows-10-10.0.18362-SP0)
+ - azsdk-python-storage-blob/12.4.0 Python/3.8.5 (Windows-10-10.0.18362-SP0)
x-ms-copy-source:
- - https://pyacrstoragegaji2d3zddo3.blob.core.windows.net/containere54813d5/blob1
+ - https://tamerdevtest.blob.core.windows.net/containere54813d5/blob1
x-ms-date:
- - Fri, 25 Oct 2019 17:59:37 GMT
+ - Wed, 02 Sep 2020 21:55:36 GMT
x-ms-meta-status:
- copy
x-ms-version:
- - '2019-02-02'
+ - '2019-12-12'
method: PUT
uri: https://storagename.blob.core.windows.net/containere54813d5/blob1copy
response:
@@ -119,19 +121,21 @@ interactions:
content-length:
- '0'
date:
- - Fri, 25 Oct 2019 17:59:36 GMT
+ - Wed, 02 Sep 2020 21:55:36 GMT
etag:
- - '"0x8D75975199480F2"'
+ - '"0x8D84F8AEC722DFD"'
last-modified:
- - Fri, 25 Oct 2019 17:59:37 GMT
+ - Wed, 02 Sep 2020 21:55:36 GMT
server:
- Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0
x-ms-copy-id:
- - 530e75bb-3f05-457e-9ea7-67ab48b5dabc
+ - 2cf9e669-0ae6-477c-bf7b-e8d0d5e49fc8
x-ms-copy-status:
- success
x-ms-version:
- - '2019-02-02'
+ - '2019-12-12'
+ x-ms-version-id:
+ - '2020-09-02T21:55:36.3912189Z'
status:
code: 202
message: Accepted
@@ -145,38 +149,39 @@ interactions:
Connection:
- keep-alive
User-Agent:
- - azsdk-python-storage-blob/12.0.0b5 Python/3.6.3 (Windows-10-10.0.18362-SP0)
+ - azsdk-python-storage-blob/12.4.0 Python/3.8.5 (Windows-10-10.0.18362-SP0)
x-ms-date:
- - Fri, 25 Oct 2019 17:59:37 GMT
+ - Wed, 02 Sep 2020 21:55:36 GMT
x-ms-version:
- - '2019-02-02'
+ - '2019-12-12'
method: GET
uri: https://storagename.blob.core.windows.net/containere54813d5?include=copy&restype=container&comp=list
response:
body:
string: "\uFEFFblob1Fri,
- 25 Oct 2019 17:59:37 GMTFri, 25 Oct 2019 17:59:37
- GMT0x8D759751984C5A711application/octet-streamblob12020-09-02T21:55:36.1680604ZtrueWed,
+ 02 Sep 2020 21:55:36 GMTWed, 02 Sep 2020 21:55:36
+ GMT0x8D84F8AEC5020DC11application/octet-streamXrY7u+Ae7tCTyyK7j1rNww==BlockBlobHottrueunlockedavailabletrueblob1copyFri,
- 25 Oct 2019 17:59:37 GMTFri, 25 Oct 2019 17:59:37
- GMT0x8D75975199480F211application/octet-streamBlockBlobHottrueunlockedavailabletrueblob1copy2020-09-02T21:55:36.3912189ZtrueWed,
+ 02 Sep 2020 21:55:36 GMTWed, 02 Sep 2020 21:55:36
+ GMT0x8D84F8AEC722DFD11application/octet-streamXrY7u+Ae7tCTyyK7j1rNww==BlockBlobHottrueunlockedavailable530e75bb-3f05-457e-9ea7-67ab48b5dabchttps://storagename.blob.core.windows.net/containere54813d5/blob1success11/11Fri,
- 25 Oct 2019 17:59:37 GMTtrue"
+ />BlockBlobHottrueunlockedavailable2cf9e669-0ae6-477c-bf7b-e8d0d5e49fc8https://storagename.blob.core.windows.net/containere54813d5/blob1success11/11Wed,
+ 02 Sep 2020 21:55:36 GMTtrue"
headers:
content-type:
- application/xml
date:
- - Fri, 25 Oct 2019 17:59:36 GMT
+ - Wed, 02 Sep 2020 21:55:36 GMT
server:
- Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0
transfer-encoding:
- chunked
x-ms-version:
- - '2019-02-02'
+ - '2019-12-12'
status:
code: 200
message: OK
diff --git a/sdk/storage/azure-storage-blob/tests/test_block_blob_sync_copy.py b/sdk/storage/azure-storage-blob/tests/test_block_blob_sync_copy.py
index 9f95fcb5790f..4164e08de32a 100644
--- a/sdk/storage/azure-storage-blob/tests/test_block_blob_sync_copy.py
+++ b/sdk/storage/azure-storage-blob/tests/test_block_blob_sync_copy.py
@@ -31,8 +31,12 @@
class StorageBlockBlobTest(StorageTestCase):
def _setup(self, storage_account, key):
+ account_url = self.account_url(storage_account, "blob")
+ if not isinstance(account_url, str):
+ account_url = account_url.encode('utf-8')
+ key = key.encode('utf-8')
self.bsc = BlobServiceClient(
- self.account_url(storage_account, "blob"),
+ account_url,
credential=key,
connection_data_block_size=4 * 1024,
max_single_put_size=32 * 1024,
diff --git a/sdk/storage/azure-storage-blob/tests/test_page_blob.py b/sdk/storage/azure-storage-blob/tests/test_page_blob.py
index de618198ef0e..ec8c669868f3 100644
--- a/sdk/storage/azure-storage-blob/tests/test_page_blob.py
+++ b/sdk/storage/azure-storage-blob/tests/test_page_blob.py
@@ -410,7 +410,11 @@ def test_update_page_unicode(self, resource_group, location, storage_account, st
@GlobalStorageAccountPreparer()
def test_upload_pages_from_url(self, resource_group, location, storage_account, storage_account_key):
# Arrange
- bsc = BlobServiceClient(self.account_url(storage_account, "blob"), credential=storage_account_key, connection_data_block_size=4 * 1024, max_page_size=4 * 1024)
+ account_url = self.account_url(storage_account, "blob")
+ if not isinstance(account_url, str):
+ account_url = account_url.encode('utf-8')
+ storage_account_key = storage_account_key.encode('utf-8')
+ bsc = BlobServiceClient(account_url, credential=storage_account_key, connection_data_block_size=4 * 1024, max_page_size=4 * 1024)
self._setup(bsc)
source_blob_data = self.get_random_bytes(SOURCE_BLOB_SIZE)
source_blob_client = self._create_source_blob(bsc, source_blob_data, 0, SOURCE_BLOB_SIZE)