mirror of
https://github.com/QwenLM/qwen-code.git
synced 2025-12-21 09:17:53 +00:00
Sync upstream Gemini-CLI v0.8.2 (#838)
This commit is contained in:
@@ -118,7 +118,6 @@ ${result.llmContent}`;
|
||||
lines,
|
||||
mimetype,
|
||||
path.extname(this.params.absolute_path),
|
||||
undefined,
|
||||
programming_language,
|
||||
),
|
||||
);
|
||||
@@ -182,9 +181,16 @@ export class ReadFileTool extends BaseDeclarativeTool<
|
||||
}
|
||||
|
||||
const workspaceContext = this.config.getWorkspaceContext();
|
||||
if (!workspaceContext.isPathWithinWorkspace(filePath)) {
|
||||
const projectTempDir = this.config.storage.getProjectTempDir();
|
||||
const resolvedFilePath = path.resolve(filePath);
|
||||
const resolvedProjectTempDir = path.resolve(projectTempDir);
|
||||
const isWithinTempDir =
|
||||
resolvedFilePath.startsWith(resolvedProjectTempDir + path.sep) ||
|
||||
resolvedFilePath === resolvedProjectTempDir;
|
||||
|
||||
if (!workspaceContext.isPathWithinWorkspace(filePath) && !isWithinTempDir) {
|
||||
const directories = workspaceContext.getDirectories();
|
||||
return `File path must be within one of the workspace directories: ${directories.join(', ')}`;
|
||||
return `File path must be within one of the workspace directories: ${directories.join(', ')} or within the project temp directory: ${projectTempDir}`;
|
||||
}
|
||||
if (params.offset !== undefined && params.offset < 0) {
|
||||
return 'Offset must be a non-negative number';
|
||||
@@ -194,7 +200,7 @@ export class ReadFileTool extends BaseDeclarativeTool<
|
||||
}
|
||||
|
||||
const fileService = this.config.getFileService();
|
||||
if (fileService.shouldGeminiIgnoreFile(params.absolute_path)) {
|
||||
if (fileService.shouldQwenIgnoreFile(params.absolute_path)) {
|
||||
return `File path '${filePath}' is ignored by .qwenignore pattern(s).`;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user