Skip to content

win32 path.normalize() not correctly normalizing relative paths containing ../ that advance above root #17928

@peteward44

Description

@peteward44
  • Version: 9.3.0
  • Platform: Windows 10 64bit
  • Subsystem: path

edit: See below comment for correct replication code

const path = require( 'path' );
const n = path.normalize( '../dir1/../../dir2' );
console.log( n );

Should output ../../dir2 but outputs dir2.

After some investigation it appears to have been introduced via commit b98e8d995efb426bbdee56ce503017bdcbbc6332 (path: fix normalize on directories with two dots)

Metadata

Metadata

Assignees

No one assigned

    Labels

    confirmed-bugIssues with confirmed bugs.pathIssues and PRs related to the path subsystem.

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions