Skip to content

Commit

Permalink
path: fix toNamespacedPath on Windows
Browse files Browse the repository at this point in the history
PR-URL: nodejs#52915
Fixes: nodejs#30224
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
  • Loading branch information
huseyinacacak-janea authored and bmeck committed Jun 22, 2024
1 parent e9cd54e commit ec4a1c8
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/path.js
Original file line number Diff line number Diff line change
Expand Up @@ -647,7 +647,7 @@ const win32 = {
return `\\\\?\\${resolvedPath}`;
}

return path;
return resolvedPath;
},

/**
Expand Down
3 changes: 2 additions & 1 deletion test/parallel/test-path-makelong.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,8 @@ assert.strictEqual(path.win32.toNamespacedPath('\\\\foo\\bar'),
'\\\\?\\UNC\\foo\\bar\\');
assert.strictEqual(path.win32.toNamespacedPath('//foo//bar'),
'\\\\?\\UNC\\foo\\bar\\');
assert.strictEqual(path.win32.toNamespacedPath('\\\\?\\foo'), '\\\\?\\foo');
assert.strictEqual(path.win32.toNamespacedPath('\\\\?\\foo'), '\\\\?\\foo\\');
assert.strictEqual(path.win32.toNamespacedPath('\\\\?\\c:\\Windows/System'), '\\\\?\\c:\\Windows\\System');
assert.strictEqual(path.win32.toNamespacedPath(null), null);
assert.strictEqual(path.win32.toNamespacedPath(true), true);
assert.strictEqual(path.win32.toNamespacedPath(1), 1);
Expand Down

0 comments on commit ec4a1c8

Please sign in to comment.