kevva / kevva/decompress

Specific uscase error: empty dir in zip archive

Open
#107 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
419
Forks
55
PR merge metrics
No merged PRs in 30d

Description

Hi there,

This is not an issue but more of a specific usecase fix.

I encountered an error (ENOENT) when the a zip file contains an empty dir. The problem might be generated by the zipping utility, because the **type** field id set to **file** instead of **dir**.

Changing [this line](https://github.com/kevva/decompress/blob/84a8c1046946add1a6ae01c54dbebf312e4ffc85/index.js#L81) to:
```
if (x.type === 'directory' || x.path.endsWith('/')) {
```
solves the problem.

It looks like nobody else had this issue so I'm posting it this just in case someone, in the future might have the same problem as I did. My specific use case is related to the unzipping of a [Writerside](https://www.jetbrains.com/writerside/) created archive. There is an empty **resources** folder (probably is only empty in this specific situation) that is included in the archive but errors on extraction.

Thank you all for your time and effort.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start at index.js line 81 and inspect how archive entries use their type and path during extraction. Reproduce the Writerside archive with its empty resources directory; done means extraction succeeds without an ENOENT error for that directory.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, nodejs
Domain
tooling
Issue type
Bug
Difficulty
1/5
Estimated time
Under an hour
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
50/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.