Repository navigation
Commit 3fea8d0
fix(react): make the filename sanitizer do what its comments claim
Two places the code and its own documentation disagreed, both found by review.
RESERVED was `$`-anchored on the whole name while the comment above it said
"reserved names remain reserved with an extension — `CON.csv` is still `CON`".
Only a bare `CON` was caught; `CON.csv`, `nul.txt` and `COM1.csv` sailed
through. Device names are now matched against the stem before the first dot,
with `desktop.ini` / `thumbs.db` kept as whole-name matches since those are
files rather than devices. Reachable through the `fileName` escape hatch.
The byte clamp ran last, so a 180-byte cut landing on a `.` or `-` re-created
exactly the trailing punctuation the trim exists to remove — and Windows strips
a trailing dot, so the name on disk would differ again. Trimming now happens
after clamping.
Both mutation-proven: re-anchoring RESERVED and moving the clamp back to last
each turn the suite red.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>1 parent 8f3b1e2 commit 3fea8d0
2 files changed
Lines changed: 42 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| 8 | + | |
8 | 9 | | |
9 | 10 | | |
10 | 11 | | |
| |||
351 | 352 | | |
352 | 353 | | |
353 | 354 | | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
46 | 46 | | |
47 | 47 | | |
48 | 48 | | |
49 | | - | |
50 | | - | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
51 | 65 | | |
52 | 66 | | |
53 | 67 | | |
| |||
164 | 178 | | |
165 | 179 | | |
166 | 180 | | |
167 | | - | |
| 181 | + | |
168 | 182 | | |
169 | 183 | | |
170 | 184 | | |
171 | 185 | | |
172 | 186 | | |
173 | | - | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
174 | 191 | | |
175 | 192 | | |
176 | 193 | | |
| |||
0 commit comments