Skip to content

Preserve directory creation errors in ensureDir - #292

Open
omrzk wants to merge 1 commit into
patrickjuchli:masterfrom
omrzk:fix/ensure-dir-creation-error-218
Open

omrzk wants to merge 1 commit into
patrickjuchli:masterfrom
omrzk:fix/ensure-dir-creation-error-218

Conversation

@omrzk

@omrzk omrzk commented Nov 13, 2026

Copy link
Copy Markdown

ensureDir() discards a failed MKD response before trying CWD. When creation is denied and the directory is missing, callers therefore receive a file-not-found error instead of the server's access-denied reason.

Keep the creation rejection if entering that directory also receives an FTP error. Existing directories can still be entered after an unsuccessful MKD, and successful creation and transport failures retain their existing errors.

Fixes #218.

Validation: npm test passes on Node 22.23.2 and 24.22.2 (including lint, TypeScript compilation, and all unit tests). Five real local TCP mock-server cases cover the regression, existing and newly created directories, CWD rejection, and connection loss. The exact tests fail once on unmodified master, with four preservation controls passing. Docker integration tests and a Microsoft FTP server were not run locally.

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.

ensureDir should throw on Access Denied during MKD

1 participant