mirror of
https://github.com/QwenLM/qwen-code.git
synced 2026-05-04 22:51:08 +00:00
Add and improve JSDoc comments for core tool methods (#3128)
This commit is contained in:
parent
654f8aeb61
commit
8d3fec08e5
7 changed files with 55 additions and 6 deletions
|
|
@ -96,6 +96,13 @@ export class WriteFileTool
|
|||
this.client = this.config.getGeminiClient();
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if a given path is within the root directory bounds.
|
||||
* This security check prevents writing files outside the designated root directory.
|
||||
*
|
||||
* @param pathToCheck The absolute path to validate
|
||||
* @returns True if the path is within the root directory, false otherwise
|
||||
*/
|
||||
private isWithinRoot(pathToCheck: string): boolean {
|
||||
const normalizedPath = path.normalize(pathToCheck);
|
||||
const normalizedRoot = path.normalize(this.config.getTargetDir());
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue