Zero (0) size files extraction fails

Aug 7, 2012 at 9:37 AM

This class is great and works beautifully except for one small problem:

Zero size files added to the zip cannot be extracted using Windows Explorer.

I can extract 0 size files with ZipStorer or 7-zip but using the Windows Explorer to open the zip and double-clicking the file reports "Windows cannot complete the operation, the destination file cannot be created". Trying to extract the file gives "Error 0x80004005: Unspecified Error".

If I create a zip using 7-zip containing the same 0 size file, everything is okay; 7-zip, ZipStorer and Windows Explorer work without error.

Aug 7, 2012 at 10:30 AM

It appears that the zero size file has been added to the zip with deflate not store and Windows Explorer doesn't like it.

Aug 7, 2012 at 10:37 AM
Edited Aug 7, 2012 at 10:42 AM

It looks like a simple change to AddStream. Can anyone spot side effects to this?


zfe.Method = _method;


zfe.Method = _source.Length == 0 ? Compression.Store : _method;

Should there be a non-zero minimum size to use Deflate and use Store if smaller?