Skip to content

fix: don't change text encoding on sources that may include binary files#503

Open
quagsirus wants to merge 2 commits intoTryGhost:mainfrom
quagsirus:fix-binary-zip
Open

fix: don't change text encoding on sources that may include binary files#503
quagsirus wants to merge 2 commits intoTryGhost:mainfrom
quagsirus:fix-binary-zip

Conversation

@quagsirus
Copy link
Copy Markdown

@quagsirus quagsirus commented Apr 23, 2026

fixes #502

i found the option in documentation here https://gulpjs.com/docs/en/api/src/#options

the output of text files seems binary-equivalent to before this change, tested with sha256sum on the Edge theme
the output of binary files different to before this change, but is now identical to their source form (and they arent corrupted as a result) :3

the fix here should probably be applied to every theme's gulpfile.js alongside the one in this monorepo - i'm not fully sure if that should be done through separate PRs to each theme's repository, or done in this one? if it's best done in this pr please let me know

i will not be reading the ai generated feedback, if they somehow give any useful information please could a sentient being let me know


Note

Low Risk
Low risk: this only tweaks Gulp src options for the zip packaging tasks, affecting how files are read during archive creation. Main risk is unintended changes in the generated zip contents if any tooling relied on text decoding behavior.

Overview
Ensures theme zip builds don’t corrupt binary assets by updating all zipper tasks to read sources as raw bytes (encoding: false) instead of applying text encoding.

This change is applied in the root gulpfile.js theme zipper (monorepo build) and across each theme’s gulpfile.js, so packaged .zip outputs should now preserve binary files exactly as they exist on disk.

Reviewed by Cursor Bugbot for commit 30c4734. Bugbot is set up for automated code reviews on this repo. Configure here.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 23, 2026

Walkthrough

The gulpfile.js was modified to add an encoding: false option to the src glob configuration in the zipper task. This prevents Gulp from automatically encoding file streams as UTF-8 when reading files for compression, allowing binary files to be streamed without modification.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~5 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed The code change directly addresses issue #502 by adding encoding: false to the gulp.src options, preventing binary file corruption during zipping as required.
Out of Scope Changes check ✅ Passed The single-line change to gulpfile.js is directly in scope, addressing the binary file corruption issue without introducing unrelated modifications.
Description check ✅ Passed The pull request description clearly relates to the changeset by explaining the fix for binary file corruption in zip tasks and referencing the specific documentation source for the encoding option used.
Title check ✅ Passed The title accurately describes the main change: disabling automatic text encoding in the zipper task to prevent corruption of binary files during zip creation.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@quagsirus
Copy link
Copy Markdown
Author

looks like changes to other themes are mainly done via PRs to this monorepo, so will follow suit

@quagsirus quagsirus changed the title don't change text encoding on sources that may include binary files fix: don't change text encoding on sources that may include binary files Apr 23, 2026
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.

Fonts and images (any binary files) are being corrupted during zip command

1 participant