Skip to content

Commit 6ffabb1

Browse files
committed
style: fix linter errors
1 parent 732e182 commit 6ffabb1

File tree

2 files changed

+23
-23
lines changed

2 files changed

+23
-23
lines changed

lib/path.js

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -397,29 +397,29 @@ const win32 = {
397397
j++;
398398
}
399399
if (j === len || j !== last) {
400-
if (firstPart === '.' || firstPart === '?') {
401-
// We matched a device root (e.g. \\\\.\\PHYSICALDRIVE0)
402-
device = `\\\\${firstPart}`;
403-
rootEnd = 4;
404-
const colonIndex = StringPrototypeIndexOf(path, ':');
405-
406-
if (colonIndex !== -1) {
407-
// Handle \\?\COM1: or similar reserved device paths with colon
408-
const possibleDevice = StringPrototypeSlice(path, 4, colonIndex + 1);
409-
if (isWindowsReservedName(possibleDevice, possibleDevice.length - 1)) {
410-
device = `\\\\?\\${possibleDevice}`;
411-
rootEnd = 4 + possibleDevice.length;
412-
}
413-
} else {
414-
// Handle \\.\CON or \\?\CON where the colon is missing
415-
const possibleDevice = StringPrototypeSlice(path, 4);
416-
const upper = StringPrototypeToUpperCase(possibleDevice);
417-
if (ArrayPrototypeIncludes(WINDOWS_RESERVED_NAMES, upper)) {
418-
device = `\\\\.\\${possibleDevice}`;
419-
rootEnd = 4 + possibleDevice.length;
400+
if (firstPart === '.' || firstPart === '?') {
401+
// We matched a device root (e.g. \\\\.\\PHYSICALDRIVE0)
402+
device = `\\\\${firstPart}`;
403+
rootEnd = 4;
404+
const colonIndex = StringPrototypeIndexOf(path, ':');
405+
406+
if (colonIndex !== -1) {
407+
// Handle \\?\COM1: or similar reserved device paths with colon
408+
const possibleDevice = StringPrototypeSlice(path, 4, colonIndex + 1);
409+
if (isWindowsReservedName(possibleDevice, possibleDevice.length - 1)) {
410+
device = `\\\\?\\${possibleDevice}`;
411+
rootEnd = 4 + possibleDevice.length;
412+
}
413+
} else {
414+
// Handle \\.\CON or \\?\CON where the colon is missing
415+
const possibleDevice = StringPrototypeSlice(path, 4);
416+
const upper = StringPrototypeToUpperCase(possibleDevice);
417+
if (ArrayPrototypeIncludes(WINDOWS_RESERVED_NAMES, upper)) {
418+
device = `\\\\.\\${possibleDevice}`;
419+
rootEnd = 4 + possibleDevice.length;
420+
}
420421
}
421-
}
422-
} else if (j === len) {
422+
} else if (j === len) {
423423
// We matched a UNC root only
424424
// Return the normalized version of the UNC root since there
425425
// is nothing left to process

test/parallel/test-path-win32-normalize-device-missing-colon.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,4 @@ assert.strictEqual(path.win32.normalize('\\\\.\\PhysicalDrive0'), '\\\\.\\Physic
2424
// 4. Check join behavior (to ensure it acts as a root)
2525
// If it's a root, joining '..' should not strip the device.
2626
const joined = path.win32.join('\\\\.\\CON', '..');
27-
assert.strictEqual(joined, '\\\\.\\CON');
27+
assert.strictEqual(joined, '\\\\.\\CON');

0 commit comments

Comments
 (0)