Skip to content

fix: report errors for missing directory sources - #869

Open
vhinayindia wants to merge 1 commit into
archiverjs:masterfrom
vhinayindia:fix-directory-missing-path-error
Open

vhinayindia wants to merge 1 commit into
archiverjs:masterfrom
vhinayindia:fix-directory-missing-path-error

Conversation

@vhinayindia

Copy link
Copy Markdown

When directory() receives a source path that does not exist, readdir-glob treats the missing root as an empty result. Archiver can therefore finish without reporting the filesystem error.

Check the source path before starting traversal. If it cannot be read, balance the pending traversal, abort the incomplete archive, emit the filesystem error, and reject finalize() with the same error. A file path still reaches readdir-glob and reports ENOTDIR.

Fixes #488.

Tests: npm test (41 passing, 1 pending); npx prettier --check lib/core.js test/archiver.js.

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

Successfully merging this pull request may close these issues.

archiver does not throw error if the target does not exist

1 participant