Skip to content

Commit c4429c8

Browse files
committed
Revert "path: fix win32 normalize false-positive on reserved names"
This reverts commit b0a4f16 as it was merged without green Jenkins CI and subsequent builds are broken. Refs: #64159 Signed-off-by: Anna Henningsen <anna@addaleax.net> PR-URL: #64216 Reviewed-By: Filip Skokan <panva.ip@gmail.com> Reviewed-By: Daijiro Wachi <daijiro.wachi@gmail.com> Reviewed-By: Michaël Zasso <targos@protonmail.com>
1 parent 1c12dd6 commit c4429c8

2 files changed

Lines changed: 1 addition & 12 deletions

File tree

lib/path.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -471,7 +471,7 @@ const win32 = {
471471
} while ((index = StringPrototypeIndexOf(path, ':', index + 1)) !== -1);
472472
}
473473
const colonIndex = StringPrototypeIndexOf(path, ':');
474-
if (colonIndex !== -1 && isWindowsReservedName(path, colonIndex)) {
474+
if (isWindowsReservedName(path, colonIndex)) {
475475
return `.\\${device ?? ''}${tail}`;
476476
}
477477
if (device === undefined) {

test/parallel/test-path-normalize.js

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -69,17 +69,6 @@ assert.strictEqual(path.win32.normalize('//server/share/dir/../../../?/D:/file')
6969
assert.strictEqual(path.win32.normalize('//server/goodshare/../badshare/file'),
7070
'\\\\server\\goodshare\\badshare\\file');
7171

72-
// A path is only a Windows reserved device name when the reserved name is
73-
// followed by a colon. A name that merely starts with a reserved name (and has
74-
// no colon) must be left untouched and not be prefixed with `.\`.
75-
assert.strictEqual(path.win32.normalize('CONx'), 'CONx');
76-
assert.strictEqual(path.win32.normalize('NULs'), 'NULs');
77-
assert.strictEqual(path.win32.normalize('LPT1x'), 'LPT1x');
78-
assert.strictEqual(path.win32.normalize('PRNzzz'), 'PRNzzz');
79-
assert.strictEqual(path.win32.normalize('CON'), 'CON');
80-
// With a trailing colon the reserved-name handling still applies.
81-
assert.strictEqual(path.win32.normalize('CON:'), '.\\CON:.');
82-
8372
assert.strictEqual(path.posix.normalize('./fixtures///b/../b/c.js'),
8473
'fixtures/b/c.js');
8574
assert.strictEqual(path.posix.normalize('/foo/../../../bar'), '/bar');

0 commit comments

Comments
 (0)