From af1f5afbf995dcd272f23de892472997f96cf526 Mon Sep 17 00:00:00 2001 From: Rakshith Bhyravabhotla Date: Mon, 21 Oct 2019 17:16:32 -0700 Subject: [PATCH 1/3] minor fix special char --- .../azure-storage-blob/azure/storage/blob/_blob_client.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 492212c3f55f..a459c5760f91 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 @@ -212,7 +212,7 @@ def _format_url(self, hostname): self.scheme, hostname, quote(container_name), - quote(self.blob_name, safe='~'), + quote(self.blob_name, safe="~()$=',"), self._query_str) @classmethod From efba2a9a5d599645e06b855bd12d6d5740ebbbaf Mon Sep 17 00:00:00 2001 From: Rakshith Bhyravabhotla Date: Mon, 21 Oct 2019 23:16:37 -0700 Subject: [PATCH 2/3] fix auth --- .../azure-storage-blob/azure/storage/blob/_blob_client.py | 2 +- .../azure/storage/blob/_shared/authentication.py | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) 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 a459c5760f91..492212c3f55f 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 @@ -212,7 +212,7 @@ def _format_url(self, hostname): self.scheme, hostname, quote(container_name), - quote(self.blob_name, safe="~()$=',"), + quote(self.blob_name, safe='~'), self._query_str) @classmethod diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/_shared/authentication.py b/sdk/storage/azure-storage-blob/azure/storage/blob/_shared/authentication.py index 6806bf922584..022e1941b6b3 100644 --- a/sdk/storage/azure-storage-blob/azure/storage/blob/_shared/authentication.py +++ b/sdk/storage/azure-storage-blob/azure/storage/blob/_shared/authentication.py @@ -76,7 +76,8 @@ def _get_verb(self, request): def _get_canonicalized_resource(self, request): uri_path = urlparse(request.http_request.url).path try: - if isinstance(request.context.transport, AioHttpTransport): + if isinstance(request.context.transport, AioHttpTransport) or \ + isinstance(getattr(request.context.transport, "_transport"), AioHttpTransport): uri_path = URL(uri_path) return '/' + self.account_name + str(uri_path) except TypeError: From 0c3de089ecf2f5bd6a07e127cb030f0775b7eca8 Mon Sep 17 00:00:00 2001 From: Rakshith Bhyravabhotla Date: Mon, 21 Oct 2019 23:54:50 -0700 Subject: [PATCH 3/3] comments --- .../azure/storage/blob/_shared/authentication.py | 2 +- .../azure/storage/file/_shared/authentication.py | 3 ++- .../azure/storage/queue/_shared/authentication.py | 3 ++- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/_shared/authentication.py b/sdk/storage/azure-storage-blob/azure/storage/blob/_shared/authentication.py index 022e1941b6b3..a8db96d4a051 100644 --- a/sdk/storage/azure-storage-blob/azure/storage/blob/_shared/authentication.py +++ b/sdk/storage/azure-storage-blob/azure/storage/blob/_shared/authentication.py @@ -77,7 +77,7 @@ def _get_canonicalized_resource(self, request): uri_path = urlparse(request.http_request.url).path try: if isinstance(request.context.transport, AioHttpTransport) or \ - isinstance(getattr(request.context.transport, "_transport"), AioHttpTransport): + isinstance(getattr(request.context.transport, "_transport", None), AioHttpTransport): uri_path = URL(uri_path) return '/' + self.account_name + str(uri_path) except TypeError: diff --git a/sdk/storage/azure-storage-file/azure/storage/file/_shared/authentication.py b/sdk/storage/azure-storage-file/azure/storage/file/_shared/authentication.py index 6806bf922584..a8db96d4a051 100644 --- a/sdk/storage/azure-storage-file/azure/storage/file/_shared/authentication.py +++ b/sdk/storage/azure-storage-file/azure/storage/file/_shared/authentication.py @@ -76,7 +76,8 @@ def _get_verb(self, request): def _get_canonicalized_resource(self, request): uri_path = urlparse(request.http_request.url).path try: - if isinstance(request.context.transport, AioHttpTransport): + if isinstance(request.context.transport, AioHttpTransport) or \ + isinstance(getattr(request.context.transport, "_transport", None), AioHttpTransport): uri_path = URL(uri_path) return '/' + self.account_name + str(uri_path) except TypeError: diff --git a/sdk/storage/azure-storage-queue/azure/storage/queue/_shared/authentication.py b/sdk/storage/azure-storage-queue/azure/storage/queue/_shared/authentication.py index 6806bf922584..a8db96d4a051 100644 --- a/sdk/storage/azure-storage-queue/azure/storage/queue/_shared/authentication.py +++ b/sdk/storage/azure-storage-queue/azure/storage/queue/_shared/authentication.py @@ -76,7 +76,8 @@ def _get_verb(self, request): def _get_canonicalized_resource(self, request): uri_path = urlparse(request.http_request.url).path try: - if isinstance(request.context.transport, AioHttpTransport): + if isinstance(request.context.transport, AioHttpTransport) or \ + isinstance(getattr(request.context.transport, "_transport", None), AioHttpTransport): uri_path = URL(uri_path) return '/' + self.account_name + str(uri_path) except TypeError: