mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
bpo-34341: Fix appending to ZIP archives with the ZIP64 extension. (GH-8683)
This commit is contained in:
parent
da8d72c953
commit
9bdb7be482
3 changed files with 38 additions and 0 deletions
|
@ -770,6 +770,20 @@ class StoredTestZip64InSmallFiles(AbstractTestZip64InSmallFiles,
|
|||
with zipfile.ZipFile(TESTFN2, "r", zipfile.ZIP_STORED) as zipfp:
|
||||
self.assertEqual(zipfp.namelist(), ["absolute"])
|
||||
|
||||
def test_append(self):
|
||||
# Test that appending to the Zip64 archive doesn't change
|
||||
# extra fields of existing entries.
|
||||
with zipfile.ZipFile(TESTFN2, "w", allowZip64=True) as zipfp:
|
||||
zipfp.writestr("strfile", self.data)
|
||||
with zipfile.ZipFile(TESTFN2, "r", allowZip64=True) as zipfp:
|
||||
zinfo = zipfp.getinfo("strfile")
|
||||
extra = zinfo.extra
|
||||
with zipfile.ZipFile(TESTFN2, "a", allowZip64=True) as zipfp:
|
||||
zipfp.writestr("strfile2", self.data)
|
||||
with zipfile.ZipFile(TESTFN2, "r", allowZip64=True) as zipfp:
|
||||
zinfo = zipfp.getinfo("strfile")
|
||||
self.assertEqual(zinfo.extra, extra)
|
||||
|
||||
@requires_zlib
|
||||
class DeflateTestZip64InSmallFiles(AbstractTestZip64InSmallFiles,
|
||||
unittest.TestCase):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue