Closed georgzoeller closed 9 years ago
On further inspection, it is becoming more clear that this code has never run, there's more wrong with it.
The if () filter inside the .map function generates undefined entries in the returned path array for any directory in the zip structure, so even with my fix, only zip files that don't have a sub directory structure will successfully extract. All other's will fail further down the chain when file.path is tested against the first undefined entry.
I got this problem too
decompress-zip:0.0.6: Extracting a simple zip file with one level of empty directory at the root will throw an TypeError on path.join decompress-zip.js:259 if strip:1 is set
The issue is in decompress-zip.js:109..120, which, instead of adding .path to the file entry, is returning the path directly in files.map().
Note: The current tests do not detect the issue as they do not validate the feature at all - they just test strip to see if an exception is thrown for the 'stripping too deep' case. Ideally, the stripping too deep test case should validate the exact exception expected and a new test case with strip:1 should be added.