Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Yauzl throws uncatchable error #65

Closed
PanMan opened this issue Nov 15, 2017 · 10 comments
Closed

Yauzl throws uncatchable error #65

PanMan opened this issue Nov 15, 2017 · 10 comments

Comments

@PanMan
Copy link

PanMan commented Nov 15, 2017

yauzl throws this error that I seem to be unable to catch or prevent:

 events.js:183
       throw er; // Unhandled 'error' event
      ^
 Error: invalid characters in fileName: some name\, de something something 5.6.vcf
     at /app/node_modules/yauzl/index.js:417:70
     at /app/node_modules/yauzl/index.js:622:5
     at /app/node_modules/fd-slicer/index.js:32:7
     at FSReqWrap.wrapper [as oncomplete] (fs.js:658:17)

Am I doing something wrong? This started happening a few weeks ago, on very few files. Sanitizing file names doesnt seem to solve it.

@thejoshwolfe
Copy link
Owner

thejoshwolfe commented Nov 15, 2017

It looks like you're not listening for the error event on the zipfile object. See https://github.com/thejoshwolfe/yauzl/blob/master/README.md#how-to-avoid-crashing

@PanMan
Copy link
Author

PanMan commented Nov 15, 2017

Thanks, missed that part, added some code and will do some more testing...

@PanMan
Copy link
Author

PanMan commented Nov 17, 2017

You are right, in that I had to listen to the error event.

Got an Zip Err Error: invalid characters in fileName: some name\, de something 3e verd. kamer 5.6.vcf
2017-11-17T14:46:54.977807+00:00 app[worker.1]:     at /app/node_modules/yauzl/index.js:417:70
2017-11-17T14:46:54.977808+00:00 app[worker.1]:     at /app/node_modules/yauzl/index.js:622:5
2017-11-17T14:46:54.977808+00:00 app[worker.1]:     at /app/node_modules/fd-slicer/index.js:32:7
2017-11-17T14:46:54.977809+00:00 app[worker.1]:     at FSReqWrap.wrapper [as oncomplete] (fs.js:658:17)

However, how do I prevent this? I don't even mind skipping the file (its not a file I need), can I process the file further?

@andrewrk
Copy link
Collaborator

Did you read the documentation?

@thejoshwolfe
Copy link
Owner

This issue has come up before in #54. A workaround for recovering from zipfiles corrupted in this way isn't documented in the readme, but maybe it should be.

@thejoshwolfe
Copy link
Owner

@PanMan can you tell what client is creating zipfiles with \ characters in file names?

@thejoshwolfe
Copy link
Owner

Please reopen if you have any other questions.

@PanMan
Copy link
Author

PanMan commented Mar 20, 2018

Sorry, I missed this notification. We use Yauzl to process chat archives created by WhatsApp. It hasn't happened often, but did happen a few times.

@thejoshwolfe thejoshwolfe reopened this Mar 20, 2018
@thejoshwolfe
Copy link
Owner

I am interested in reproducing the backslash filename problem. I have WhatsApp for android, and i've been looking into creating a chat backup of conversations.

Is there any advice you can give me to help me reproduce this issue? There's no rush. I may not make any substantial progress on this issue for a few weeks.

@thejoshwolfe
Copy link
Owner

Backslashes are now silently converted to forward slashes as of 6a9e652 published in yauzl 2.10.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants