#345: Fix Content-Type application/zip on gzip-encoded upload bodies#350
Conversation
|
@yegor256 please review |
|
CI failure note: The All 118 other tests pass, and all non-live checks (rubocop, copyrights, markdown-lint, pdd, reuse, xcop, actionlint, typos, yamllint) pass successfully. |
zerocracy#345: Fix Content-Type application/zip on gzip-encoded upload bodies
|
@VasilevNStas Thanks for the contribution! You've earned +20 points for this: +24 as a basis; -4 for too few (26) hits-of-code as per our policy which deducts 4 points when contributing less than 30 hits-of-code. Remember, our bonus system rewards consistent, quality contributions while encouraging optimal code size - aim for 30+ hits-of-code to avoid the deduction and maximize your bonus! Please, keep them coming. Your running score is +346; don't forget to check your Zerocracy account too. |
Problem
BazaRb#zippedsetContent-Type: application/zipon gzip-compressed upload bodies. The body is a gzip stream (written byZlib::GzipWriter), not a ZIP archive. TheContent-Encoding: gzipheader already names the transport encoding. The wrong media type causes servers that route byContent-Typebefore decoding to reject legitimate uploads.Solution
Removed
'Content-Type' => 'application/zip'from thezippedmethod. The originalContent-Type: application/octet-streamset byuploadnow survives through compression. OnlyContent-Encoding: gzipandContent-Lengthare added when compression is on.Verification
bundle exec rubocop— 0 offensestest_push_compressed_contentto expectapplication/octet-streamtest_push_compressed_headers_are_correctverifies both headers via WebMockCloses #345.