fix: prevent .whl files from being corrupted during pack#1782
Conversation
There was a problem hiding this comment.
Pull request overview
This PR fixes an issue in the uipath CLI packager where .whl files (wheel archives) included via packOptions.fileExtensionsIncluded could be corrupted during packaging due to being treated as text instead of binary. It updates the binary-extension classification so wheel files are written byte-for-byte into the resulting .nupkg, and adds a regression test to ensure the packed wheel content round-trips unmodified.
Changes:
- Add
.whlto the CLI’s archive/binary extension set so wheels are handled as binary. - Add a regression test that generates a wheel-like zip with high-byte content and verifies it is not altered in the
.nupkg. - Bump
uipathpackage version to2.12.3(and update lockfile accordingly).
Reviewed changes
Copilot reviewed 3 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| packages/uipath/src/uipath/_cli/_utils/_constants.py | Treat .whl as an archive/binary extension so it’s packed without text transcoding. |
| packages/uipath/tests/cli/test_pack.py | Adds regression coverage to verify .whl bytes are preserved exactly through packing. |
| packages/uipath/pyproject.toml | Version bump to 2.12.3. |
| packages/uipath/uv.lock | Lockfile updated for the new local package version. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|



Summary
.whlto the packager's binary-file extensions so wheel files added viapackOptions.fileExtensionsIncludedare copied byte-for-byte into the.nupkg.whlwith high-byte content and asserts it round-trips unmodifiedWhy
Files not in
BINARY_EXTENSIONSare read as text (with a latin-1 fallback that "succeeds" on any byte sequence) and rewritten viazipfile.writestr(str), which re-encodes as UTF-8. For a.whlfile (itself a zip full of arbitrary binary bytes), this silently corrupts the archive, so a wheel bundled into a package this way becomes an unreadable zip at runtime ("Invalid zip file structure"). This surfaced while validating an offline dependency bundling workflow for #1603.Development Packages
uipath