Skip to content

mimic node's intended behavior with weird paths - #344

Open
isaacs wants to merge 1 commit into
mainfrom
isaacs/rm-cwd
Open

isaacs wants to merge 1 commit into
mainfrom
isaacs/rm-cwd

Conversation

@isaacs

@isaacs isaacs commented Mar 4, 2026

Copy link
Copy Markdown
Owner

When removing any path that has .. or . as path portions, call
path.normalize on the path before attempting to process it.

When removing the path '', throw a stat ENOENT error.

When removing ., replace with process.cwd() and proceed as normal.

Also, add support for deleting file: URLs and Buffer paths, which are
normalized to string for the benefit of older Node versions.

Glob patterns must still be normal string values.

This mirrors the behavior of node, once nodejs/node#61968 lands.

Closes: #342
Fixes: #326
Re: nodejs/node#61958
Credit: @abhu85, @RajeshKumar11, @isaacs

@isaacs
isaacs force-pushed the isaacs/rm-cwd branch 2 times, most recently from 59359ac to cce8085 Compare March 4, 2026 00:43
When removing any path that has `..` or `.` as path portions, call
`path.normalize` on the path before attempting to process it.

When removing the path `''`, throw a `stat ENOENT` error.

When removing `.`, replace with `process.cwd()` and proceed as normal.

Also, add support for deleting `file:` URLs and Buffer paths, which are
normalized to `string` for the benefit of older Node versions.

Glob patterns must still be normal `string` values.

This mirrors the behavior of node, once nodejs/node#61968 lands.

Closes: #342
Fixes: #326
Re: nodejs/node#61958
Credit: @abhu85, @RajeshKumar11, @isaacs

This branch has not been deployed

No deployments
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.

rimraf params validate problem

1 participant