Skip to content

Commit

Permalink
Harden TextSearchProvider (again) (#1294)
Browse files Browse the repository at this point in the history
  • Loading branch information
isc-bsaviano authored Dec 29, 2023
1 parent 1bfdc90 commit 99eb41a
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/providers/FileSystemProvider/TextSearchProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -314,8 +314,9 @@ export class TextSearchProvider implements vscode.TextSearchProvider {
// The server reported no matches in this file
!file.matches.length ||
// The file name is malformed
(file.doc.includes("/") && !/\/(?:[^/]+\/)+[^/.]*(?:\.[^/.]+)+/.test(file.doc)) ||
(!file.doc.includes("/") && !/(%?[\p{L}\d\u{100}-\u{ffff}]+(?:\.[\p{L}\d\u{100}-\u{ffff}]+)+)/u.test(file.doc))
(file.doc.includes("/") && !/^\/(?:[^/]+\/)+[^/.]*(?:\.[^/.]+)+$/.test(file.doc)) ||
(!file.doc.includes("/") &&
!/^(%?[\p{L}\d\u{100}-\u{ffff}]+(?:\.[\p{L}\d\u{100}-\u{ffff}]+)+)$/u.test(file.doc))
) {
return;
}
Expand Down

0 comments on commit 99eb41a

Please sign in to comment.