Skip to content

Commit 4cf240f

Browse files
authored
Check rooignore for insert_content and search_and_replace (#4094)
1 parent aa62654 commit 4cf240f

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

src/core/tools/insertContentTool.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,14 @@ export async function insertContentTool(
5858
return
5959
}
6060

61+
const accessAllowed = cline.rooIgnoreController?.validateAccess(relPath)
62+
63+
if (!accessAllowed) {
64+
await cline.say("rooignore_error", relPath)
65+
pushToolResult(formatResponse.toolError(formatResponse.rooIgnoreError(relPath)))
66+
return
67+
}
68+
6169
const absolutePath = path.resolve(cline.cwd, relPath)
6270
const fileExists = await fileExistsAtPath(absolutePath)
6371

src/core/tools/searchAndReplaceTool.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,14 @@ export async function searchAndReplaceTool(
115115
endLine: endLine,
116116
}
117117

118+
const accessAllowed = cline.rooIgnoreController?.validateAccess(validRelPath)
119+
120+
if (!accessAllowed) {
121+
await cline.say("rooignore_error", validRelPath)
122+
pushToolResult(formatResponse.toolError(formatResponse.rooIgnoreError(validRelPath)))
123+
return
124+
}
125+
118126
const absolutePath = path.resolve(cline.cwd, validRelPath)
119127
const fileExists = await fileExistsAtPath(absolutePath)
120128

0 commit comments

Comments
 (0)