In s3tests/functional/test_s3.py, test_get_object_torrent() calls _get_body(response) which unconditionally does got.decode() when the body is bytes.
A .torrent file is a bencoded binary format. The pieces field contains raw SHA1 digests, so the response body is not guaranteed to be valid UTF-8. When a backend returns an actual torrent body, the test can fail with UnicodeDecodeError even though the server is correct.
Suggested fix: in test_get_object_torrent, read response["Body"].read() as bytes and compare against data.encode("utf-8") (do not decode).
PR prepared on fork: drey123/s3-tests (branch omni-fix-torrent-bytes).
In
s3tests/functional/test_s3.py,test_get_object_torrent()calls_get_body(response)which unconditionally doesgot.decode()when the body is bytes.A
.torrentfile is a bencoded binary format. Thepiecesfield contains raw SHA1 digests, so the response body is not guaranteed to be valid UTF-8. When a backend returns an actual torrent body, the test can fail withUnicodeDecodeErroreven though the server is correct.Suggested fix: in
test_get_object_torrent, readresponse["Body"].read()as bytes and compare againstdata.encode("utf-8")(do not decode).PR prepared on fork: drey123/s3-tests (branch omni-fix-torrent-bytes).