sereko / theunarchiver

Automatically exported from code.google.com/p/theunarchiver
Other
0 stars 0 forks source link

Cannot extract some zero length files from ZIP archives #177

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Zero length files aren't being properly extracted from ZIP files. Using The
Unarchiver Beta 3. This happens if they're the last file in the archive.

% unzip -l Test.zip 
Archive:  Test.zip
  Length     Date   Time    Name
 --------    ----   ----    ----
        0  07-25-09 07:41   test.txt
 --------                   -------
        0                   1 file

Extracting this file with The Unarchiver creates no files.

% unzip -l Test2.zip
Archive:  Test2.zip
  Length     Date   Time    Name
 --------    ----   ----    ----
        0  07-28-09 04:49   test1.txt
        0  07-28-09 04:49   test2.txt
 --------                   -------
        0                   2 files

Extracting this one only creates test1.txt.

I'm guessing a possible fix would be to replace
if(uncompsize==0&&!([dict objectForKey:XADIsDirectoryKey]&&[[dict
objectForKey:XADIsDirectoryKey] boolValue]))
with 
if(uncompsize==0&&!([dict objectForKey:XADIsDirectoryKey]&&[[dict
objectForKey:XADIsDirectoryKey] boolValue])&&i<numentries-1)
in line 272 of XADZipParser.m (untested).

Original issue reported on code.google.com by eksopl on 28 Jul 2009 at 3:58

Attachments:

GoogleCodeExporter commented 9 years ago
Yes, that's the problem. It could also be fixed by adding an if(prevdict) [self 
addEntryWithDictionary:prevdict]; at 
the end, but I went with yours.

Original comment by paracel...@gmail.com on 30 Jul 2009 at 7:11