Skip to content

#345: Fix Content-Type application/zip on gzip-encoded upload bodies#350

Merged
yegor256 merged 1 commit into
zerocracy:masterfrom
VasilevNStas:345
Jun 5, 2026
Merged

#345: Fix Content-Type application/zip on gzip-encoded upload bodies#350
yegor256 merged 1 commit into
zerocracy:masterfrom
VasilevNStas:345

Conversation

@VasilevNStas

@VasilevNStas VasilevNStas commented Jun 3, 2026

Copy link
Copy Markdown
Contributor

Problem

BazaRb#zipped set Content-Type: application/zip on gzip-compressed upload bodies. The body is a gzip stream (written by Zlib::GzipWriter), not a ZIP archive. The Content-Encoding: gzip header already names the transport encoding. The wrong media type causes servers that route by Content-Type before decoding to reject legitimate uploads.

Solution

Removed 'Content-Type' => 'application/zip' from the zipped method. The original Content-Type: application/octet-stream set by upload now survives through compression. Only Content-Encoding: gzip and Content-Length are added when compression is on.

Verification

  • bundle exec rubocop — 0 offenses
  • All tests pass (46 edge tests, 132 assertions)
  • Updated test_push_compressed_content to expect application/octet-stream
  • New test test_push_compressed_headers_are_correct verifies both headers via WebMock

Closes #345.

@VasilevNStas

Copy link
Copy Markdown
Contributor Author

@yegor256 please review

@VasilevNStas VasilevNStas changed the title #345: remove application/zip Content-Type from zipped method #345: Fix Content-Type application/zip on gzip-encoded upload bodies Jun 5, 2026
@VasilevNStas

Copy link
Copy Markdown
Contributor Author

CI failure note: The test_live_full_cycle failure in the CI is unrelated to this PR. It's a pre-existing infrastructure issue with the Zerocracy platform (jobs not completing on the live server). See issue #354 for details and discussion.

All 118 other tests pass, and all non-live checks (rubocop, copyrights, markdown-lint, pdd, reuse, xcop, actionlint, typos, yamllint) pass successfully.

@yegor256
yegor256 merged commit 6032172 into zerocracy:master Jun 5, 2026
8 of 10 checks passed
VasilevNStas pushed a commit to VasilevNStas/baza.rb that referenced this pull request Jun 5, 2026
zerocracy#345: Fix Content-Type application/zip on gzip-encoded upload bodies
@0crat

0crat commented Jun 5, 2026

Copy link
Copy Markdown

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

BazaRb#zipped sets Content-Type to application/zip on gzip-encoded upload bodies

3 participants