zippy icon indicating copy to clipboard operation
zippy copied to clipboard

can't open zip file Unhandled exception: Unsupported zip archive [ZippyError] (deflate64)

Open bung87 opened this issue 3 years ago • 6 comments

https://github.com/bung87/finder/tree/zippy

I previously use std zip lib which works fine and test passed, when switch to zippy I got Unhandled exception: Unsupported zip archive [ZippyError]

the zip file compression through mac context menu, am on platform: macOS nim version: 1.4.4

bung87 avatar Mar 30 '21 11:03 bung87

This happens when the general purpose value has the "data descriptor" bit set. I do not support this now. I've not seen a zip archive with it used. How did you create a the zip archive with this flag set? I'd be curious to see if I can reproduce that and add support and tests for this flag being set.

https://users.cs.jmu.edu/buchhofp/forensics/formats/pkzip.html https://pkware.cachefly.net/webdocs/casestudies/APPNOTE.TXT

guzba avatar Mar 30 '21 20:03 guzba

I checked the general purpose flag , echo tobin(generalPurposeFlag.int,16) on mac outputs 0000000000001000 https://pkware.cachefly.net/webdocs/casestudies/APPNOTE.TXT described as Bit 4: Reserved for use with method 8, for enhanced deflating.

I compressed directory through mac context menu Compress menu item , don't know the underling software flags. you can check Archive.zip under tests folder , it extract fine with std zip lib and mac The Unarchiver

bung87 avatar Mar 30 '21 21:03 bung87

Hm, it looks like Mac is writing Zip64 files sometimes. I know I've tested with Mac archives that worked fine in the past.

Zip64 are different from standard Zip files even though they share an extension. Zip64 is generally supported in most places. There isn't much for docs on this and they are not clear as to what exactly 'enhanced deflating" is. I'm assuming it means Deflate64 instead of standard Deflate for compression.

Deflate64 is not the same as standard Deflate. It is different enough to require quite a bit of work and is not something I plan to work on in the short term, sorry.

guzba avatar Mar 30 '21 22:03 guzba

After google found deflate64 also called "enhanced deflate" is PKWare proprietary, that's why I can't find any open source implementation.

bung87 avatar Mar 30 '21 23:03 bung87

It's interesting that Mac is generating zip archives with enhanced deflate. If we learn more we can add it to this issue. I'm going to add "deflate64" to the issue title too quick.

guzba avatar Mar 31 '21 01:03 guzba

yeah , I think std zip module can work because its zip header point to PKWare's header not the open source zlib

bung87 avatar Mar 31 '21 03:03 bung87