Skip to content

Fix zip corruption in pre command output#147

Merged
ajaynes-godaddy merged 1 commit into
masterfrom
mwc-19894
Jun 10, 2026
Merged

Fix zip corruption in pre command output#147
ajaynes-godaddy merged 1 commit into
masterfrom
mwc-19894

Conversation

@agibson-godaddy

@agibson-godaddy agibson-godaddy commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

Summary

  • copyPrereleaseTask in tasks/copy.js was reading the build zip via gulp.src without encoding: false, causing gulp 5 to round-trip the binary through utf-8 and corrupt the archive.
  • The same encoding: false flag is already applied in copyBuildTask, copyWpAssetsTask, and zipTask for the same reason — this brings copyPrereleaseTask in line.
  • See gulpjs/gulp#2790 for the underlying gulp behavior.

Fixes #145
Jira: MWC-19894

Test plan

  • Run sake build then sake pre in a plugin directory
  • Unzip the resulting prerelease zip — confirm it extracts without errors
  • Upload the zip to a WordPress site as a plugin — confirm install succeeds without PCLZIP_ERR_BAD_FORMAT or unpack warnings

🤖 Generated with Claude Code

Pass encoding: false to gulp.src in copyPrereleaseTask so the bundled
zip isn't corrupted by utf-8 round-tripping when copied from build/ to
the prereleases folder.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes prerelease zip corruption during the sake pre workflow by ensuring the build zip is read as binary data (Buffer) rather than being implicitly decoded/encoded as UTF-8 by gulp/vinyl-fs.

Changes:

  • Update copyPrereleaseTask to call gulp.src(..., { encoding: false }) so .zip contents are not corrupted.
  • Add an inline comment referencing the gulp upstream issue explaining why encoding: false is required.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@ajaynes-godaddy ajaynes-godaddy left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

QA checks out, LGTM!

Side note: I ended updating the Using-a-development-version-of-Saké wiki page after getting a refresher course for this PR. 😁

@ajaynes-godaddy ajaynes-godaddy merged commit 6e95703 into master Jun 10, 2026
1 check passed
@ajaynes-godaddy ajaynes-godaddy deleted the mwc-19894 branch June 10, 2026 22:14
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.

Errors unpacking zips created by the pre command

3 participants