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 committed May 13, 2024
1 parent 29884d1 commit dcd8b82
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
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
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 dcd8b82

Please sign in to comment.