question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Create 2 options to decodeStrings without validateFileName

See original GitHub issue

Thank you for this lib, it works great ! In my use case, i’d like to ignore the “invalid characters in fileName” errors, to automatically convert backslashes to forward slashes. I read that @thejoshwolfe recommands using decodeStrings: false here: https://github.com/thejoshwolfe/yauzl/issues/54#issuecomment-287585919 But as he mentions it:

You’ll have to do some extra work to do UTF-8 vs CP437 decoding

It’s too bad to do this extra work whereas the lib can do it, and this work isn’t directly linked to the validation step. I’d like to create 2 different options:

  • autoValidateFileName: default true, if false, the method validateFileName isn’t called
  • decodeStrings: default true, if false, don’t decode Buffer.

Or if my use case is not so specific, maybe we can add an option authorizeBackslash to avoid throwing an error in validateFileName.

What do you think about it ?

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:2
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
thejoshwolfecommented, Apr 27, 2018

I found a suggestion online that Microsoft .NET framework 4.5.0 until 4.6.1 had a bug where System.IO.Compression.ZipFile would not canonicalize the paths you passed into it.

I won’t be able to test this myself for several weeks, but this may be the implementation (or one of them) that produced these malformed zipfiles we’re all seeing floating around the internet. If I can get confirmation that we’ve found the culprit, I’ll add an option to fix zipfiles while reading them (which will probably be enabled by default).

0reactions
thejoshwolfecommented, Jul 3, 2018

published yauzl 2.10.0 which replaces backslashes by default. let me know if this solves your problem.

Read more comments on GitHub >

github_iconTop Results From Across the Web

yauzl - npm
If decodeStrings is true , entries emitted via this event have already passed file name validation. See validateFileName() and open() for ...
Read more >
Yauzl: Yet another Unzip Library for Node - Morioh
When decodeStrings is false , strictFileNames has no effect. ... When this ZipFile was created with the lazyEntries option set to true ,...
Read more >
api documentation for yauzl (v2.8.0)
fromRandomAccessReader (reader, totalSize, options, callback); function yauzl.open (path, options, callback); function yauzl.validateFileName (fileName) ...
Read more >
How to Make an Instagram Poll With More Than 2 Options
Want to create a poll on Instagram story with 3 options? Check out 4 ways to add more than 2 options in Instagram...
Read more >
How To Get Four Options on Instagram Polls - YouTube
We can now add more option to IG polls! Here's what to know!DONE-WITH-YOU CONTENT (So You Can Get Back To Running Your Business...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found