Commit ee3875f
refactor(workspaces): replace regex with string matching for file extensions
Replace regex-based pattern matching with simple string comparison in
`doesFilenameMatchExtension` and `replaceFileExtension` functions to
avoid unintended behavior with special characters.
Changes:
- Use `endsWith()` instead of regex for extension matching
- Add support for compound extensions (e.g., 'seqn.txt')
- Use string slicing instead of regex replacement
- Add validation check before replacing extension
- Remove tests for regex special character handling
- Add tests for compound extension scenarios
This prevents issues where special regex characters in extensions
(like `*`, `+`, `.`) would be interpreted as patterns rather than
literal strings, making extension matching more predictable and correct.1 parent 7f8e80b commit ee3875f
2 files changed
Lines changed: 21 additions & 13 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1390 | 1390 | | |
1391 | 1391 | | |
1392 | 1392 | | |
| 1393 | + | |
| 1394 | + | |
| 1395 | + | |
| 1396 | + | |
| 1397 | + | |
| 1398 | + | |
1393 | 1399 | | |
1394 | 1400 | | |
1395 | 1401 | | |
| |||
1459 | 1465 | | |
1460 | 1466 | | |
1461 | 1467 | | |
1462 | | - | |
1463 | | - | |
1464 | | - | |
1465 | | - | |
1466 | | - | |
1467 | | - | |
1468 | | - | |
1469 | | - | |
1470 | 1468 | | |
1471 | 1469 | | |
1472 | 1470 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
367 | 367 | | |
368 | 368 | | |
369 | 369 | | |
370 | | - | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
371 | 374 | | |
372 | 375 | | |
373 | 376 | | |
374 | | - | |
375 | | - | |
376 | | - | |
377 | | - | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
378 | 388 | | |
379 | 389 | | |
380 | 390 | | |
| |||
0 commit comments