Skip to content

Commit

Permalink
assert filename
Browse files Browse the repository at this point in the history
  • Loading branch information
AndreasArvidsson committed Jul 13, 2024
1 parent 1229e4b commit f21dc26
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,11 @@ export class FileSystemRawTreeSitterQueryProvider
onChanges = this.notifier.registerListener;

readQuery(filename: string): Promise<string | undefined> {
if (filename !== path.basename(filename)) {
throw Error(
`${filename} should only be a file name and not a relative path`,
);
}
const queryPath = path.join(this.queryDir, filename);
return this.fileSystem.readBundledFile(queryPath);
}
Expand Down

0 comments on commit f21dc26

Please sign in to comment.