Skip to content

Commit 2757ba4

Browse files
cristipufuclaude
andcommitted
fix: read files in binary mode during pack to prevent content trimming on Windows
Text files were opened in text mode during packing, causing Python's universal newline translation to convert CRLF to LF on Windows. This silently trimmed file content when git's autocrlf converted LF to CRLF on checkout. Also normalizes zip entry paths to use forward slashes on Windows. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent c522b2e commit 2757ba4

3 files changed

Lines changed: 7 additions & 20 deletions

File tree

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "uipath"
3-
version = "2.10.1"
3+
version = "2.10.2"
44
description = "Python SDK and CLI for UiPath Platform, enabling programmatic interaction with automation services, process management, and deployment tools."
55
readme = { file = "README.md", content-type = "text/markdown" }
66
requires-python = ">=3.11"

src/uipath/_cli/cli_pack.py

Lines changed: 5 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -292,24 +292,11 @@ def pack_fn(
292292
)
293293

294294
for file in files:
295-
if file.is_binary:
296-
# Read binary files in binary mode
297-
with open(file.file_path, "rb") as f:
298-
z.writestr(f"content/{file.relative_path}", f.read())
299-
else:
300-
try:
301-
# Try UTF-8 first
302-
with open(file.file_path, "r", encoding="utf-8") as f:
303-
z.writestr(f"content/{file.relative_path}", f.read())
304-
except UnicodeDecodeError:
305-
# If UTF-8 fails, try with utf-8-sig (for files with BOM)
306-
try:
307-
with open(file.file_path, "r", encoding="utf-8-sig") as f:
308-
z.writestr(f"content/{file.relative_path}", f.read())
309-
except UnicodeDecodeError:
310-
# If that also fails, try with latin-1 as a fallback
311-
with open(file.file_path, "r", encoding="latin-1") as f:
312-
z.writestr(f"content/{file.relative_path}", f.read())
295+
archive_path = f"content/{file.relative_path}"
296+
if os.sep != "/":
297+
archive_path = archive_path.replace(os.sep, "/")
298+
with open(file.file_path, "rb") as f:
299+
z.writestr(archive_path, f.read())
313300

314301

315302
def display_project_info(config):

uv.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)