max-mapper / max-mapper/extract-zip
Extracting specials characters from OSX archive
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 398
- Forks
- 144
- PR merge metrics
- No merged PRs in 30d
Description
Hi there,
Using extract-zip with multiples platforms, our team found out that an underlying bug into yaulz (which is itself caused by OSX archiver bug) cause OSX archives containing special characters to have wrongly encoded filenames:
See:
https://github.com/thejoshwolfe/yauzl/issues/84
https://github.com/thejoshwolfe/yauzl/issues/69
Issue being that extract-zip itself work using the default { decodeStrings: true } parameter, which make it loose the original buffer.
I've implemented a fix here: https://github.com/Clovis-team/extract-zip/commit/a68d7657bc2e1bf1711ee5c79893464eebeb7cad
The idea is to introduce chardet as a 'fallback' for the missing utf-8 flag, and if his detection have enough confidence that the passed buffer is indeed utf-8, pretend that the "utf-8 flag" has been set.
I'm not sure it's the best way to go with this problem, so I'm open to suggestions on other ways to handle this issue. I'll probably also propose the same fix into yaulz directly so maybe in near future we could remove this patch by simply upgrade yaulz to latest version. But in the meantime, this could already fix the issue for this package.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reviewing the linked yauzl issues and the proposed commit a68d7657bc2e1bf1711ee5c79893464eebeb7cad. Reproduce extraction of an OSX archive containing special-character filenames, then verify that filenames are preserved when the UTF-8 flag is missing and that the behavior remains correct for ordinary archives.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100