-
Notifications
You must be signed in to change notification settings - Fork 29.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
win32 path.normalize() not correctly normalizing relative paths containing ../ that advance above root #17928
Comments
cc/ @nodejs/platform-windows @targos |
Can't reproduce on macOS, so assuming this is Windows specific. |
Cant' reproduce on Windows either:
|
This is strange, let me take another look to see what's happening |
OK - my example was bad. Sorry about that, try this:
Should output |
Okay, can reproduce that with v6.12.0 but not v6.11.5 (on macOS), which suggests b98e8d9 is indeed the cause of the issue. ▶▶▶ nvm i v6.11.5 ~/wrk/com/DANGER/node (v8.9.4-proposal)
v6.11.5 is already installed.
Now using node v6.11.5 (npm v3.10.10)
▶▶▶ node -p "path.normalize( '../../../dir1/../../../dir2' );" ~/wrk/com/DANGER/node 2s (v8.9.4-proposal)
../../../../../dir2
▶▶▶ nvm use 6.12.0 ~/wrk/com/DANGER/node (v8.9.4-proposal)
Now using node v6.12.0 (npm v3.10.10)
▶▶▶ node -p "path.normalize( '../../../dir1/../../../dir2' );" ~/wrk/com/DANGER/node 1s (v8.9.4-proposal)
../dir2 |
Cool, i would have submitted a PR myself but i was unsure of the correct behaviour that b98e8d9 was supposed to fix. Thanks for looking at this 👍 |
After slicing, the `lastSegmentLength` should be calculated again, instead of assigning value `j`. Fixes: nodejs#17928
edit: See below comment for correct replication code
Should output
../../dir2
but outputsdir2
.After some investigation it appears to have been introduced via commit b98e8d995efb426bbdee56ce503017bdcbbc6332 (path: fix normalize on directories with two dots)
The text was updated successfully, but these errors were encountered: