-
-
Notifications
You must be signed in to change notification settings - Fork 324
Description
Summary
Some of the zip files produced by our app include empty directories. I think by default those wouldn't be included in the archive, but we explicitly add them when we create the zip files using SSZipArchive.
When extracting these zip files using ZipFoundation, those empty directories are extracted as zero-length files instead. Digging into the bits set for the external attributes for those entries, I think ZipFoundation is technically correct that they are marked as files instead of directories (as best I could figure out with my limited knowledge of the zip format). So probably that is a bug in SSZipArchive.
However, using the system unzip on Mac, it does properly extract them as directories. I'm guessing that instead of looking at the attributes, it is basing that on the trailing slash at the end of the path.
Given that (as far as I know) it is not legal for a filename to contain a slash on any platform, would you consider changing the extraction logic so that any file entry with a trailing slash is extracted as a directory?
Steps to Reproduce
Use ZipFoundation to unzip this zip file:
Expected Results
The resulting unzipped files include empty directories for all entries that end in a slash.
Actual Results
Entries that end in a slash are extracted as zero-length files.
Regression & Version
Occurs in 0.9.19