Skip to content

Commit

Permalink
SignV4: trim leading/trailing spaces in header value (minio#1435)
Browse files Browse the repository at this point in the history
Signed-off-by: Bala.FA <[email protected]>
  • Loading branch information
balamurugana authored Aug 17, 2024
1 parent 935500a commit c9b4c49
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion minio/signer.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()))
Expand Down
7 changes: 6 additions & 1 deletion tests/functional/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit c9b4c49

Please sign in to comment.