diff --git a/minio/signer.py b/minio/signer.py index 3e60beb91..83cf89831 100644 --- a/minio/signer.py +++ b/minio/signer.py @@ -74,7 +74,7 @@ def _get_canonical_headers( ): values = values if isinstance(values, (list, tuple)) else [values] ordered_headers[key] = ",".join([ - _MULTI_SPACE_REGEX.sub(" ", value) for value in values + _MULTI_SPACE_REGEX.sub(" ", value).strip() for value in values ]) ordered_headers = OrderedDict(sorted(ordered_headers.items())) diff --git a/tests/functional/tests.py b/tests/functional/tests.py index 7def5ba85..f6a043f2d 100644 --- a/tests/functional/tests.py +++ b/tests/functional/tests.py @@ -692,7 +692,12 @@ def test_put_object(log_entry, sse=None): reader = LimitedRandomReader(length) log_entry["args"]["data"] = "LimitedRandomReader(11 * MB)" log_entry["args"]["metadata"] = metadata = { - 'x-amz-meta-testing': 'value', 'test-key': 'value2'} + 'x-amz-meta-testing': 'value', + 'test-key': 'value2', + "My-Project": "Project One", + "My-header1": " a b c ", + "My-Header2": "\"a b c\"", + } log_entry["args"]["content_type"] = content_type = ( "application/octet-stream") log_entry["args"]["object_name"] = object_name + "-metadata"