-
Notifications
You must be signed in to change notification settings - Fork 79
Closed
Description
Error
On Mac OS X 10.12.6 the native zip utility (right-click "compress folder") creates a zip file that gives this error:
extra field length exceeds extra field buffer size
Not that I don't believe it's possible for Apple to make a mistake, but my guess is that the underlying zip utility is probably the same Unix / Darwin zip that has been in use for a very long time and that it's statistically more likely to be a problem with this library.
For reference, here is the failing zip file (just a couple of test files for a website):
Example Zip File
I've attached fails-to-parse.zip for the test case.
The contents are as follows:
.
├── css
│ ├── custom.css
│ ├── plugins
│ │ └── bootstrap.css.min
│ └── styles.css
├── index-three.html
├── index-two.html
├── index.html
└── js
├── app.js
├── config.js
└── custom.js
I have also zipped files that do unzip just fine. My guess is that there's some sort of off-by-one byte alignment issue.
Test Case
And a test case (based on the example):
mkdir -p /tmp/yauzl-test
pushd /tmp/yauzl-test
npm install yauzl@latest
touch test.js
wget -c https://github.com/thejoshwolfe/yauzl/files/1420073/fails-to-parse.zip
# => copy code below into test.js <= #
node test.jstest.js:
'use strict';
var yauzl = require('yauzl');
yauzl.open('./fails-to-parse.zip', function (err, zipfile) {
if (err) throw err;
zipfile.readEntry();
zipfile.on('entry', function (entry) {
if (/\/$/.test(entry.fileName)) {
zipfile.readEntry();
return;
}
zipfile.openReadStream(entry, function(err, readStream) {
if (err) throw err;
readStream.on("end", function() {
zipfile.readEntry();
});
readStream.on("data", function (data) {
console.log("data of length", data.length);
});
});
});
zipfile.on('error', function (err) {
throw err;
});
zipfile.on('end', function () {
console.log("all entries read and processed");
});
});Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels