Skip to content

Commit 99eb41a

Browse files
authored
Harden TextSearchProvider (again) (#1294)
1 parent 1bfdc90 commit 99eb41a

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)