From 097db7644c9029dbbe5aaab44a937805bfdb0d9d Mon Sep 17 00:00:00 2001 From: Anis Elleuch Date: Fri, 13 Sep 2019 17:34:39 +0100 Subject: [PATCH 1/2] Do not encode ~ in V4 S3 signing --- minio/signer.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/minio/signer.py b/minio/signer.py index c5983e1a..f0715ca9 100644 --- a/minio/signer.py +++ b/minio/signer.py @@ -251,7 +251,9 @@ def generate_canonical_request(method, parsed_url, headers, signed_headers, cont :param headers: HTTP header dictionary. :param content_sha256: Content sha256 hexdigest string. """ - lines = [method, parsed_url.path, parsed_url.query] + # Use url encoded path with ~ as an exception + parsed_url_path = parsed_url.path.replace("%7E", "~") + lines = [method, parsed_url_path, parsed_url.query] # Headers added to canonical request. header_lines = [] From 86c221d6dd70ea0300f70452702442012b7e78a3 Mon Sep 17 00:00:00 2001 From: Anis Elleuch Date: Mon, 16 Sep 2019 11:03:21 +0100 Subject: [PATCH 2/2] Update minio/signer.py Co-Authored-By: kannappanr <30541348+kannappanr@users.noreply.github.com> --- minio/signer.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/minio/signer.py b/minio/signer.py index f0715ca9..8bf8af35 100644 --- a/minio/signer.py +++ b/minio/signer.py @@ -251,7 +251,7 @@ def generate_canonical_request(method, parsed_url, headers, signed_headers, cont :param headers: HTTP header dictionary. :param content_sha256: Content sha256 hexdigest string. """ - # Use url encoded path with ~ as an exception + # Should not encode ~. Decode it back if present. parsed_url_path = parsed_url.path.replace("%7E", "~") lines = [method, parsed_url_path, parsed_url.query]