allanlei / python-zipstream

Like Python's ZipFile module, except it works as a generator that provides the file in many small chunks.
GNU General Public License v3.0
128 stars 34 forks source link

Run filesize comparisons if not running in streaming mode. #20

Open rmathure opened 8 years ago

rmathure commented 8 years ago

When streaming zip content using SMBHandler and not writing the data to a file(streaming data out instead), the check at https://github.com/allanlei/python-zipstream/blob/master/zipstream/__init__.py#L328 detects that the data transferred (filesize) is greater than ZIP64_LIMIT. The Zip64 flag even after being set during initialization, has the variable zip64 set to False which cause the RuntimeError 'File size has increased during compressing'.

This is my proposed solution: We should only check the file size or the compress size when we are writing to a file i.e. filename is specified.

This solution works for my use case where I am streaming in/out data but I leave the actual implementation to fix this bug to the authors.

tombs commented 8 years ago

Hi, I've encountered the same issue. Fix recommended by rmathure works for me as well. Request that the pull request be approved or the base code updated. Thanks!

rmathure commented 7 years ago

Any updates on this PR?