Skip to content

gh-153625: rewrite with original filename in append mode for zipfile - #153626

Open
danny0838 wants to merge 7 commits into
python:mainfrom
danny0838:gh-153625
Open

danny0838 wants to merge 7 commits into
python:mainfrom
danny0838:gh-153625

Conversation

@danny0838

@danny0838 danny0838 commented Jul 12, 2026 •

Copy link
Copy Markdown
Contributor

Fix an issue that auto-sanitized filename corrupts a ZIP archive when rewritten to the central directory in append mode.

ZipInfo.orig_filename is now only set when read from an archive; otherwise it fallbacks to ZipInfo.filename. When writing, ZipInfo.orig_filename rather than ZipInfo.filename is used to ensure that the identical original filename is written back.

A setter of ZipInfo.orig_filename is provided for backword compatibility, although it is not mean to be modified. (Actually, most ZipInfo attributes should not be modified. Though I leave it to future when a breaking change is well-prepared.)

@github-actions

Copy link
Copy Markdown

This PR is stale because it has been open for 90 days with no activity.

@github-actions github-actions Bot added the stale Stale PR or inactive for long period of time. label Oct 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awaiting review stale Stale PR or inactive for long period of time.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant