Skip to content

Commit ab0d3a0

Browse files
fix: clean up regex escaping and remove unsupported brace from glob detection
- Use Biome-compatible `[.+^${}()|[\]\]` escaping in globMatch instead of the unconventional `]`-first convention that triggers noEmptyCharacterClassInRegex - Remove `{` from isGlob detection regex — globMatch does not support brace expansion, so patterns like `src/{a,b}.js` would be misdetected as globs and fail to match Impact: 2 functions changed, 7 affected
1 parent 6cf191f commit ab0d3a0

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/embedder.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ function globMatch(filePath, pattern) {
2424
// Normalize separators to forward slashes
2525
const normalized = filePath.replace(/\\/g, '/');
2626
// Escape regex specials except glob chars
27-
let regex = pattern.replace(/\\/g, '/').replace(/[.+^${}()|\\[\]]/g, '\\$&');
27+
let regex = pattern.replace(/\\/g, '/').replace(/[.+^${}()|[\]\\]/g, '\\$&');
2828
// Replace ** first (matches any path segment), then * and ?
2929
regex = regex.replace(/\*\*/g, '\0');
3030
regex = regex.replace(/\*/g, '[^/]*');
@@ -518,7 +518,7 @@ function _prepareSearch(customDbPath, opts = {}) {
518518
conditions.push('n.kind = ?');
519519
params.push(opts.kind);
520520
}
521-
const isGlob = opts.filePattern && /[*?{[\]]/.test(opts.filePattern);
521+
const isGlob = opts.filePattern && /[*?[\]]/.test(opts.filePattern);
522522
if (opts.filePattern && !isGlob) {
523523
conditions.push('n.file LIKE ?');
524524
params.push(`%${opts.filePattern}%`);

0 commit comments

Comments
 (0)