Commit 3a7fc91
committed
fix: escape all regex metacharacters in glob-to-regex conversion for Office file filtering
The filePattern filter for Excel (xlsx) and DOCX content searches converted
glob patterns to regex by only escaping '.' and '*'. Characters like '(',
')', '[', ']', '+', '^', '$', '{', '}' and '|' were left unescaped, causing
incorrect filename matches for real-world patterns such as:
- report(2024).xlsx -> '(' treated as regex group start
- [draft].xlsx -> '[draft]' treated as character class
- file+notes.docx -> '+' treated as quantifier
Fix: escape all regex special characters first (excluding '*'), then convert
the remaining glob '*' wildcards to '.*'. Both the Excel and DOCX filter
paths are updated.
Addresses CodeRabbit major finding on PR #400.1 parent c5c434b commit 3a7fc91
1 file changed
Lines changed: 10 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
408 | 408 | | |
409 | 409 | | |
410 | 410 | | |
411 | | - | |
412 | | - | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
413 | 418 | | |
414 | 419 | | |
415 | 420 | | |
| |||
582 | 587 | | |
583 | 588 | | |
584 | 589 | | |
585 | | - | |
| 590 | + | |
| 591 | + | |
| 592 | + | |
586 | 593 | | |
587 | 594 | | |
588 | 595 | | |
| |||
0 commit comments