@@ -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
0 commit comments