Skip to content

fix: prevent .whl files from being corrupted during pack#1782

Merged
radu-mocanu merged 1 commit into
mainfrom
fix/pack-whl-binary-corruption
Jul 1, 2026
Merged

fix: prevent .whl files from being corrupted during pack#1782
radu-mocanu merged 1 commit into
mainfrom
fix/pack-whl-binary-corruption

Conversation

@radu-mocanu

@radu-mocanu radu-mocanu commented Jul 1, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • add .whl to the packager's binary-file extensions so wheel files added via packOptions.fileExtensionsIncluded are copied byte-for-byte into the .nupkg
  • add a regression test that packs a .whl with high-byte content and asserts it round-trips unmodified

Why

Files not in BINARY_EXTENSIONS are read as text (with a latin-1 fallback that "succeeds" on any byte sequence) and rewritten via zipfile.writestr(str), which re-encodes as UTF-8. For a .whl file (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

[project]
dependencies = [
  # Exact version (copy-paste ready):
  "uipath==2.12.3.dev1017827077",

  # Any version from this PR (uncomment to use a range instead):
  # "uipath>=2.12.3.dev1017820000,<2.12.3.dev1017830000",
]

[[tool.uv.index]]
name = "testpypi"
url = "https://test.pypi.org/simple/"
publish-url = "https://test.pypi.org/legacy/"
explicit = true

[tool.uv.sources]
uipath = { index = "testpypi" }

Copilot AI review requested due to automatic review settings July 1, 2026 15:04
@radu-mocanu radu-mocanu added the build:dev Create a dev build from the pr label Jul 1, 2026
@github-actions github-actions Bot added test:uipath-langchain Triggers tests in the uipath-langchain-python repository test:uipath-integrations labels Jul 1, 2026

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 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 .whl to 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 uipath package version to 2.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.

@sonarqubecloud

sonarqubecloud Bot commented Jul 1, 2026

Copy link
Copy Markdown

@radu-mocanu radu-mocanu merged commit 75bcef1 into main Jul 1, 2026
110 checks passed
@radu-mocanu radu-mocanu deleted the fix/pack-whl-binary-corruption branch July 1, 2026 15:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

build:dev Create a dev build from the pr test:uipath-integrations test:uipath-langchain Triggers tests in the uipath-langchain-python repository

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants