fix: deflate manifest on zip append path

This commit is contained in:
Abdessamad Derraz committed 2026-08-07 15:45:48 +02:00
1 parent 954e093271
commit 3ecb72d275
2 files changed
+30 -2

No files matched your search

+4 -2
View File
@@ -3471,8 +3471,10 @@ def inject_manifest(zip_path: str, manifest: dict) -> None:
has_manifest = "manifest.json" in zf.namelist()
if not has_manifest:
# Fast path: append directly
with zipfile.ZipFile(zip_path, "a") as zf:
# Fast path: append directly. Append mode defaults to ZIP_STORED,
# which would leave the manifest uncompressed and give the same pack
# two different byte layouts depending on the path taken here.
with zipfile.ZipFile(zip_path, "a", zipfile.ZIP_DEFLATED) as zf:
zf.writestr("manifest.json", manifest_json)
else:
# Rebuild to replace existing manifest