Skip to content

Commit c9b4c49

Browse files
authored
SignV4: trim leading/trailing spaces in header value (minio#1435)
Signed-off-by: Bala.FA <bala@minio.io>
1 parent 935500a commit c9b4c49

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

minio/signer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ def _get_canonical_headers(
7474
):
7575
values = values if isinstance(values, (list, tuple)) else [values]
7676
ordered_headers[key] = ",".join([
77-
_MULTI_SPACE_REGEX.sub(" ", value) for value in values
77+
_MULTI_SPACE_REGEX.sub(" ", value).strip() for value in values
7878
])
7979

8080
ordered_headers = OrderedDict(sorted(ordered_headers.items()))

tests/functional/tests.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -692,7 +692,12 @@ def test_put_object(log_entry, sse=None):
692692
reader = LimitedRandomReader(length)
693693
log_entry["args"]["data"] = "LimitedRandomReader(11 * MB)"
694694
log_entry["args"]["metadata"] = metadata = {
695-
'x-amz-meta-testing': 'value', 'test-key': 'value2'}
695+
'x-amz-meta-testing': 'value',
696+
'test-key': 'value2',
697+
"My-Project": "Project One",
698+
"My-header1": " a b c ",
699+
"My-Header2": "\"a b c\"",
700+
}
696701
log_entry["args"]["content_type"] = content_type = (
697702
"application/octet-stream")
698703
log_entry["args"]["object_name"] = object_name + "-metadata"

0 commit comments

Comments
 (0)