Commit Graph

12 Commits

Author SHA1 Message Date
Jason R. Coombs 22980dc7c9
gh-106752: Sync with zipp 3.16.2 (#106757)
* gh-106752: Sync with zipp 3.16.2

* Add blurb
2023-07-15 09:21:17 -04:00
Jason R. Coombs 03185f0c15
gh-106752: Move zipfile._path into its own package (#106753)
* gh-106752: Move zipfile._path into its own package so it may have supplementary behavior.

* Add blurb
2023-07-14 20:40:46 +00:00
Carey Metcalfe 798bcaa1eb
gh-103861: Fix Zip64 extensions not being properly applied in some cases (#103863)
Fix Zip64 extensions not being properly applied in some cases:

Fixes an issue where adding a small file to a `ZipFile`
object while forcing zip64 extensions causes an extra Zip64 record to be
added to the zip, but doesn't update the `min_version` or file sizes in
the primary central directory header.

Also fixed an edge case in checking if zip64 extensions are required:

This fixes an issue where if data requiring zip64 extensions was added
to an unseekable stream without specifying `force_zip64=True`, zip64
extensions would not be used and a RuntimeError would not be raised when
closing the file (even though the size would be known at that point).
This would result in successfully writing corrupt zip files.

Deciding if zip64 extensions are required outside of the `FileHeader`
function means that both `FileHeader` and `_ZipWriteFile` will always be
in sync. Previously, the `FileHeader` function could enable zip64
extensions without propagating that decision to the `_ZipWriteFile`
class, which would then not correctly write the data descriptor record
or check for errors on close.

If anyone is actually using `ZipInfo.FileHeader` as a public API without
explicitly passing True or False in for zip64, their own code may still be
susceptible to that kind of bug unless they make a similar change to
where the zip64 decision happens.

Fixes #103861

---------

Co-authored-by: Gregory P. Smith <greg@krypto.org>
2023-05-16 00:43:44 -07:00
Carey Metcalfe 4abfe6a14b
GH-92184: Convert os.altsep to '/' in filenames when creating ZipInfo objects (#92185)
This causes the zipfile module to also consider the character defined by
`os.altsep` (if there is one) to be a path separator and convert it to a
forward slash, as defined by the zip specification.

A logical no-op on all known platforms today as os.altsep is currently only set to a meaningful value on Windows (where it is "/").
2023-05-11 07:25:16 +00:00
Yeojin Kim 8f70b16e33
gh-86094: Add support for Unicode Path Extra Field in ZipFile (gh-102566) 2023-04-05 20:54:48 +09:00
Jason R. Coombs a35fd38b57
gh-102209: Sync with zipp 3.15 moving complexity tests into dedicated module (#102232)
Sync with jaraco/zipp@757a4e1a.
2023-02-25 11:15:48 -05:00
Jason R. Coombs 36854bbb24
gh-101566: Sync with zipp 3.14. (GH-102018) 2023-02-20 13:01:58 -08:00
Tim Hatch 59e86caca8
gh-88233: zipfile: handle extras after a zip64 extra (GH-96161)
Previously, any data _after_ the zip64 extra would be removed.

With many new tests.

Fixes #88233

Automerge-Triggered-By: GH:jaraco
2023-02-20 09:07:03 -08:00
Gregory P. Smith 5927013e47
gh-101144: Allow open and read_text encoding to be positional. (#101145)
The zipfile.Path open() and read_text() encoding parameter can be supplied as a positional argument without causing a TypeError again. 3.10.0b1 included a regression that made it keyword only.

Documentation update included as users writing code to be compatible with a wide range of versions will need to consider this for some time.
2023-01-19 23:04:30 -08:00
dmjohnsson23 59665d0280
Improve zip64 limit error message (#95892) 2022-11-30 16:44:41 +05:30
Jason R. Coombs 93f22d30eb
gh-98108: Add limited pickleability to zipfile.Path (GH-98109)
* gh-98098: Move zipfile into a package.

* Moved test_zipfile to a package

* Extracted module for test_path.

* Add blurb

* Add jaraco as owner of zipfile.Path.

* Synchronize with minor changes found at jaraco/zipp@d9e7f4352d.

* gh-98108: Sync with zipp 3.9.1 adding pickleability.
2022-11-26 13:05:41 -05:00
Jason R. Coombs 7796d3179b
gh-98098: Create packages from zipfile and test_zipfile (gh-98103)
* gh-98098: Move zipfile into a package.

* Moved test_zipfile to a package

* Extracted module for test_path.

* Add blurb

* Add jaraco as owner of zipfile.Path.

* Synchronize with minor changes found at jaraco/zipp@d9e7f4352d.
2022-11-26 09:44:13 -05:00