Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions Lib/zipfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,8 @@ class LargeZipFile(Exception):
_CD64_DIRECTORY_SIZE = 8
_CD64_OFFSET_START_CENTDIR = 9

_DD_SIGNATURE = 0x08074b50

_EXTRA_FIELD_STRUCT = struct.Struct('<HH')

def _strip_extra(extra, xids):
Expand Down Expand Up @@ -1270,9 +1272,9 @@ def writestr(self, zinfo_or_arcname, bytes, compress_type=None):
self.fp.write(bytes)
if zinfo.flag_bits & 0x08:
# Write CRC and file sizes after the file data
fmt = '<LQQ' if zip64 else '<LLL'
self.fp.write(struct.pack(fmt, zinfo.CRC, zinfo.compress_size,
zinfo.file_size))
fmt = '<LLQQ' if zip64 else '<LLLL'
self.fp.write(struct.pack(fmt, _DD_SIGNATURE, zinfo.CRC,
zinfo.compress_size, zinfo.file_size))
self.fp.flush()
self.filelist.append(zinfo)
self.NameToInfo[zinfo.filename] = zinfo
Expand Down
1 change: 1 addition & 0 deletions Misc/ACKS
Original file line number Diff line number Diff line change
Expand Up @@ -1295,6 +1295,7 @@ Roger D. Serwy
Jerry Seutter
Pete Sevander
Denis Severson
Silas Sewell
Ian Seyer
Daniel Shahaf
Mark Shannon
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Improved compatibility for streamed files in :mod:`zipfile`. Previously an
optional signature was not being written and certain ZIP applications were
not supported. Patch by Silas Sewell.