Issue #25624: ZipFile now always writes a ZIP_STORED header for directory

entries.  Patch by Dingyuan Wang.
This commit is contained in:
Serhiy Storchaka 2015-11-22 14:50:25 +02:00
commit 6e3d2ba269
4 changed files with 30 additions and 1 deletions

View file

@ -1444,7 +1444,9 @@ class ZipFile:
arcname += '/'
zinfo = ZipInfo(arcname, date_time)
zinfo.external_attr = (st[0] & 0xFFFF) << 16 # Unix attributes
if compress_type is None:
if isdir:
zinfo.compress_type = ZIP_STORED
elif compress_type is None:
zinfo.compress_type = self.compression
else:
zinfo.compress_type = compress_type