From 5d88e216fbdec3fb055a915c1ba79502d0ee693c Mon Sep 17 00:00:00 2001 From: "rohan.mathure" Date: Wed, 22 Jun 2016 14:29:24 -0700 Subject: [PATCH] Run filesize comparisons if not running in streaming mode. --- zipstream/__init__.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/zipstream/__init__.py b/zipstream/__init__.py index a176935..49c6b0d 100644 --- a/zipstream/__init__.py +++ b/zipstream/__init__.py @@ -324,7 +324,8 @@ def __write(self, filename=None, iterable=None, arcname=None, compress_type=None zinfo.compress_size = file_size zinfo.CRC = CRC zinfo.file_size = file_size - if not zip64 and self._allowZip64: + # Run these checks if not running in streaming mode i.e. filename is provided + if not zip64 and self._allowZip64 and filename: if file_size > ZIP64_LIMIT: raise RuntimeError('File size has increased during compressing') if compress_size > ZIP64_LIMIT: