Commit graph

73 commits

Author SHA1 Message Date
Danny Lin
e926a954ed Sync with danny0838/zipremove@86a240bf01 2025-07-22 19:09:59 +08:00
Danny Lin
72673e0709 Sync with danny0838/zipremove@8bedf7c9b8 2025-07-03 21:49:39 +08:00
Danny Lin
725b1a3e85 Update data_offset 2025-06-29 11:46:40 +08:00
Danny Lin
0832528fa5 Sync with danny0838/zipremove@092f98b4d7 2025-06-27 15:41:00 +08:00
Danny Lin
748ac631ad Sync with danny0838/zipremove@e79042768f 2025-06-23 19:35:24 +08:00
Danny Lin
85811abea8 Simplify tests with data descriptors 2025-06-22 21:30:48 +08:00
Danny Lin
d9824ceaa6 Fix timezone related timestamp issue 2025-06-22 00:00:19 +08:00
Danny Lin
4b2176e890 Sync with danny0838/zipremove@1843d87b70 2025-06-21 23:07:50 +08:00
Danny Lin
5f093e5175 Sync with danny0838/zipremove@1691ca25bf 2025-06-20 15:34:58 +08:00
Danny Lin
1ece5b17d5 Refactor and optimize RepackHelperMixin 2025-06-14 13:55:20 +08:00
Danny Lin
c759b639ee Improve dependency check for decompression tests 2025-06-14 13:48:41 +08:00
Danny Lin
0f50a6f561 Remove unneeded variables 2025-06-14 13:48:35 +08:00
Danny Lin
cb549c95f1 Patch more explicitly 2025-06-14 13:48:28 +08:00
Danny Lin
04cddef2f7 Remove unneeded import 2025-06-01 15:57:16 +08:00
Danny Lin
b1dcb07f33 Test with pre-calculated CRC 2025-06-01 15:54:37 +08:00
Danny Lin
578c7c8b6a Add requirements 2025-06-01 15:42:07 +08:00
Danny Lin
aaa566c94c Remove unneeded import 2025-06-01 15:21:55 +08:00
Danny Lin
db9d0d6199 Add tests for _ZipRepacker 2025-06-01 15:12:23 +08:00
Danny Lin
ea3259fba7 Optimize code 2025-06-01 14:11:43 +08:00
Danny Lin
c80d21bf99 Strip only entries immediately following a referenced entry
- The previous implementation might cause [archive decryption header] and/or [archive extra data record] preceeding [central directory] be stripped.
2025-05-30 20:57:36 +08:00
Danny Lin
f8fade17a0 Introduce _scan_data_descriptor_no_sig_by_decompression 2025-05-30 20:56:31 +08:00
Danny Lin
fbf75888fc Rename methods and parameters 2025-05-28 11:46:48 +08:00
Danny Lin
3ef72c68be Add tearDown for tests 2025-05-28 11:45:47 +08:00
Danny Lin
93f4c25d39 Fix bad test code 2025-05-27 07:57:28 +08:00
Danny Lin
e76f9a1bc1 Fix bytes between entries be removed when removed is passed 2025-05-27 00:20:40 +08:00
Danny Lin
926338cbc1 Support repack(removed) 2025-05-26 23:46:17 +08:00
Danny Lin
4c35eb262d Check testzip() after zip file closed 2025-05-26 23:00:08 +08:00
Danny Lin
8a448e452b Add test for bytes between file entries 2025-05-26 22:45:20 +08:00
Danny Lin
95fde316ab Fix typo 2025-05-26 22:43:58 +08:00
Danny Lin
ae01b8cd69 Raise on overlapping file blocks 2025-05-25 21:09:12 +08:00
Danny Lin
8f0a504b20 Fix and improve validation tests
- Separate individual validation tests.
- Check underlying repacker not called in validation.
- Use `unlink` to prevent FileNotFoundError.
- Fix mode 'x' test.
2025-05-25 16:18:56 +08:00
Danny Lin
0d971d81b5 Add strict_descriptor option 2025-05-25 10:19:06 +08:00
Danny Lin
236cd06084 Optimize _calc_initial_entry_offset by introducing cache 2025-05-25 10:09:18 +08:00
Danny Lin
a4b410b9f6 Add tests for mode w and x for remove() 2025-05-24 23:03:43 +08:00
Danny Lin
72c2a6678f Handle common setups with setUpClass 2025-05-24 22:43:12 +08:00
Danny Lin
80ab2e27e4 Fix and optimize test code 2025-05-24 22:22:28 +08:00
Danny Lin
6aed859ade Add remove() and repack() to ZipFile 2025-05-24 18:54:06 +08:00
Serhiy Storchaka
2602d8ae98
gh-71339: Use new assertion methods in tests (GH-129046) 2025-05-22 13:17:22 +03:00
Tim Hatch
1298511b41
gh-72680: Fix false positives when using zipfile.is_zipfile() (GH-134250)
bpo-28494: Improve zipfile.is_zipfile reliability

The zipfile.is_zipfile function would only search for the EndOfZipfile
section header. This failed to correctly identify non-zipfiles that
contained this header. Now the zipfile.is_zipfile function verifies
the first central directory entry.

Changes:
* Extended zipfile.is_zipfile to verify zipfile catalog
* Added tests to validate failure of binary non-zipfiles
* Reuse 'concat' handling for is_zipfile

Co-authored-by: John Jolly <john.jolly@gmail.com>
2025-05-20 18:32:41 -07:00
Serhiy Storchaka
14305a83d3
gh-133677: Fix tests when running in non-UTF-8 locale (GH-133865) 2025-05-12 19:09:11 +03:00
Emma Smith
c273f59fb3
gh-132983: Add the compression.zstd pacakge and tests (#133365)
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
Co-authored-by: Gregory P. Smith <greg@krypto.org>
Co-authored-by: Tomas R. <tomas.roun8@gmail.com>
Co-authored-by: Rogdham <contact@rogdham.net>
2025-05-06 01:38:08 +01:00
Daniel Hollas
cae660d6dc
gh-118761: Add test_lazy_import for more modules (#133057)
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2025-05-05 22:46:05 +00:00
Serhiy Storchaka
0f04f2456a
gh-117779: Fix reading duplicated entries in zipfile by name (GH-129254) 2025-04-08 13:56:42 +03:00
Emma Smith
6cd1d6c6b1
gh-84481: Make ZipFile.data_offset more robust (#132178) 2025-04-08 10:43:14 +03:00
Emma Smith
0788948dcb
gh-84481: Add ZipFile.data_offset attribute (#132165)
* Add ZipFile.data_offset attribute

This attribute provides the offset to zip data from the start of the file, when available.

* Add blurb-it

* Try fixing class ref in NEWS
2025-04-06 13:51:42 -07:00
Victor Stinner
b2ca26875a
gh-131152: Remove unused imports from tests (part 2) (#131154) 2025-03-13 10:57:40 +01:00
Hood Chatham
8e57877e3f
gh-127146: Update test skips for Emscripten 4.0.1 (#129375)
Updates the Emscripten test skips to reflect recent changes in Emscripten capabilities.
2025-01-28 01:05:21 +00:00
Kirill Podoprigora
fc6d4b71eb
gh-129192: Use EnvironmentVarGuard to restore environment variables (#129193)
Co-authored-by: Cody Maloney <cmaloney@theoreticalchaos.com>
2025-01-22 20:39:26 +00:00
Wulian
5d57959d7d
gh-91279: ZipFile.writestr now respect SOURCE_DATE_EPOCH (#124435) 2025-01-20 13:12:29 -05:00
5ec1cff
dda02eb7be
GH-128131: Completely support random read access of uncompressed unencrypted files in ZipFile (#128143)
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2025-01-20 13:04:43 -05:00