Skip to content

Commit

Permalink
path: fix toNamespacedPath on Windows
Browse files Browse the repository at this point in the history
PR-URL: #52915
Fixes: #30224
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
  • Loading branch information
huseyinacacak-janea authored and marco-ippolito committed Jun 17, 2024
1 parent 26775c5 commit 84da6a5
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 84da6a5

Please sign in to comment.