diff --git a/zipstream/__init__.py b/zipstream/__init__.py index 60dbef2..4f9d7be 100644 --- a/zipstream/__init__.py +++ b/zipstream/__init__.py @@ -262,7 +262,10 @@ def __write(self, filename=None, iterable=None, arcname=None, compress_type=None else: zinfo.compress_type = compress_type - zinfo.file_size = 0 + if st: + zinfo.file_size = st[6] + else: + zinfo.file_size = 0 zinfo.flag_bits = 0x00 zinfo.flag_bits |= 0x08 # ZIP flag bits, bit 3 indicates presence of data descriptor zinfo.header_offset = self.fp.tell() # Start of header bytes