fix: remove incorrect removeClosingTag usage on file paths in WriteToFileTool

The removeClosingTag function was incorrectly being called on file paths
in the execute method. This function is meant to clean up partial XML
tags during streaming, not process actual parameter values. This was
causing file path corruption, particularly for paths after the first
file creation.

Fixes #9533
This commit is contained in:
Roo Code 2025-11-24 14:29:58 +00:00
parent becdb1ac1c
commit 893f0d7e54

View file

@ -91,12 +91,12 @@ export class WriteToFileTool extends BaseTool<"write_to_file"> {
newContent = unescapeHtmlEntities(newContent)
}
const fullPath = relPath ? path.resolve(task.cwd, removeClosingTag("path", relPath)) : ""
const fullPath = relPath ? path.resolve(task.cwd, relPath) : ""
const isOutsideWorkspace = isPathOutsideWorkspace(fullPath)
const sharedMessageProps: ClineSayTool = {
tool: fileExists ? "editedExistingFile" : "newFileCreated",
path: getReadablePath(task.cwd, removeClosingTag("path", relPath)),
path: getReadablePath(task.cwd, relPath),
content: newContent,
isOutsideWorkspace,
isProtected: isWriteProtected,