Commit dafefbb
committed
path: fix win32 normalize false-positive on reserved names
path.win32.normalize() checked names like CONx or NULs against the
Windows reserved device list (CON, NUL, PRN, LPT1, ...) by slicing off
the last character whenever the path had no colon, so any file name
that happened to be a reserved name plus one extra character got
wrongly treated as a device and prefixed with `.\`.
A previous attempt at this fix (b0a4f16, reverted in c4429c8)
guarded the check with `colonIndex !== -1`, but that also suppressed
the colon-less case Windows itself treats as reserved: a name followed
immediately by a single dot, e.g. NUL. and COM9. (per Microsoft's own
docs, "avoid these names followed immediately by an extension; NUL.txt
and NUL.tar.gz are both equivalent to NUL"), which is why it broke
Windows CI. This version keeps that dot case working while still
rejecting an arbitrary trailing character.
Signed-off-by: Alexander Kireev <ak.chatman.media@gmail.com>1 parent 5d8693e commit dafefbb
2 files changed
Lines changed: 31 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
471 | 471 | | |
472 | 472 | | |
473 | 473 | | |
474 | | - | |
| 474 | + | |
| 475 | + | |
| 476 | + | |
| 477 | + | |
| 478 | + | |
| 479 | + | |
| 480 | + | |
| 481 | + | |
| 482 | + | |
| 483 | + | |
| 484 | + | |
| 485 | + | |
| 486 | + | |
| 487 | + | |
475 | 488 | | |
476 | 489 | | |
477 | 490 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
43 | 43 | | |
44 | 44 | | |
45 | 45 | | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
46 | 63 | | |
47 | 64 | | |
48 | 65 | | |
| |||
0 commit comments