fix: encode & decode file paths (#843)

This commit is contained in:
Aiden Cline
2025-07-10 11:19:54 -05:00
committed by GitHub
parent e9c954d45e
commit 8b2a909e1f
2 changed files with 6 additions and 3 deletions

View File

@@ -350,7 +350,9 @@ export namespace Session {
switch (url.protocol) {
case "file:":
// have to normalize, symbol search returns absolute paths
const relativePath = url.pathname.replace(app.path.cwd, ".")
// Decode the pathname since URL constructor doesn't automatically decode it
const pathname = decodeURIComponent(url.pathname)
const relativePath = pathname.replace(app.path.cwd, ".")
const filePath = path.join(app.path.cwd, relativePath)
if (part.mime === "text/plain") {
@@ -414,7 +416,7 @@ export namespace Session {
return [
{
type: "text",
text: `Called the Read tool with the following input: {\"filePath\":\"${url.pathname}\"}`,
text: `Called the Read tool with the following input: {\"filePath\":\"${pathname}\"}`,
synthetic: true,
},
{