Create 2 options to decodeStrings without validateFileName
See original GitHub issueThank 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 methodvalidateFileName
isn’t calleddecodeStrings
: 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:
- Created 6 years ago
- Reactions:2
- Comments:5 (4 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
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).
published yauzl 2.10.0 which replaces backslashes by default. let me know if this solves your problem.