Skip to content

Commit 187a89b

Browse files
committed
Anchor regexes that detect bad search results (partial fix for #1292)
1 parent d520859 commit 187a89b

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/providers/FileSystemProvider/TextSearchProvider.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -314,8 +314,9 @@ export class TextSearchProvider implements vscode.TextSearchProvider {
314314
// The server reported no matches in this file
315315
!file.matches.length ||
316316
// The file name is malformed
317-
(file.doc.includes("/") && !/\/(?:[^/]+\/)+[^/.]*(?:\.[^/.]+)+/.test(file.doc)) ||
318-
(!file.doc.includes("/") && !/(%?[\p{L}\d\u{100}-\u{ffff}]+(?:\.[\p{L}\d\u{100}-\u{ffff}]+)+)/u.test(file.doc))
317+
(file.doc.includes("/") && !/^\/(?:[^/]+\/)+[^/.]*(?:\.[^/.]+)+$/.test(file.doc)) ||
318+
(!file.doc.includes("/") &&
319+
!/^(%?[\p{L}\d\u{100}-\u{ffff}]+(?:\.[\p{L}\d\u{100}-\u{ffff}]+)+)$/u.test(file.doc))
319320
) {
320321
return;
321322
}

0 commit comments

Comments
 (0)