mirror of
https://github.com/aljazceru/opencode.git
synced 2025-12-25 03:34:22 +01:00
fix: encode & decode file paths (#843)
This commit is contained in:
@@ -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,
|
||||
},
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user