node-unzipper
node-unzipper copied to clipboard
Handling 'extra data' at end of payload
Some of the zip files we receive include (as 7zip warns) 'extra data at the end of the payload'. This extra data doesn't seem to affect winRAR or 7zip's ability to extract the files though.
However when I run it through the 'normal' unzipper.Parse() pipe, the process just hangs and doesn't throw an error. When I run it through unzipper.Open.s3(), it does throw an error for
It doesn't seem to get to the same code location when running through unzipper.Parse(), and as I said just hangs instead of emitting an error. Is there any way to get the unzipper to emit an error when this happens instead?
I can't provide a sample upload unfortunately, but hopefully this makes sense.
We will have to investigate how to fix the Parse
method to behave appropriately. Currently the code for Parse and Open are separate, but at some point those should be merged as they share much of the same functionality.
The open methods allow you to specify tailSize
in options. The tailSize is basically the number of bytes to inspect away from the end of the file to locate the Central Directory. If you set tailSize high enough, the central directory should hopefully parse properly, even with the extra stuff at the end.
Please let me know if the tailSize works - also feel free to take a stab at a PR for the parse method :)
I see, yeah I can add a large enough tailSize to capture it. I think we are okay rejecting it anyway though.
I tried digging in on the Parse side for a while earlier, but I didn't find anything in the amount of time I had to spend on it. I'll try to take another look when I can if you don't fix it first.
Sounds good, I would really appreciate it if you find a solution.
Hello, I fixed same error (Error: FILE_ENDED
) with PR #209.
Hello @ZJONSSON, can you please review my PR #209?