Commit b0a4f16
committed
path: fix win32 normalize false-positive on reserved names
`path.win32.normalize()` checked for Windows reserved device names
(CON, NUL, PRN, LPT1, etc.) without first ensuring the path actually
contained a colon. When no colon was present, `indexOf(':')` returned
-1 and `isWindowsReservedName()` sliced off the last character instead
of slicing up to a colon, so any filename equal to a reserved name plus
one trailing character was wrongly treated as a device and prefixed with
`.\` — e.g. `normalize('CONx')` returned `.\CONx` instead of `CONx`.
Guard the check with `colonIndex !== -1`, matching the other reserved
name call sites which are already guarded by `colonIndex > 0`.
Signed-off-by: Daijiro Wachi <daijiro.wachi@gmail.com>
PR-URL: #64159
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Gürgün Dayıoğlu <hey@gurgun.day>1 parent d5679f4 commit b0a4f16
2 files changed
Lines changed: 12 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
471 | 471 | | |
472 | 472 | | |
473 | 473 | | |
474 | | - | |
| 474 | + | |
475 | 475 | | |
476 | 476 | | |
477 | 477 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
69 | 69 | | |
70 | 70 | | |
71 | 71 | | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
72 | 83 | | |
73 | 84 | | |
74 | 85 | | |
| |||
0 commit comments