fix: properly encode file URLs with special characters (#12424)

This commit is contained in:
Khang Ha (Kelvin)
2026-02-07 05:16:56 +07:00
committed by GitHub
parent 9db2bd3fc4
commit c908bc5c51
12 changed files with 114 additions and 22 deletions
+2 -1
View File
@@ -1,6 +1,7 @@
#!/usr/bin/env bun
import path from "path"
import { pathToFileURL } from "bun"
import { createOpencode } from "@opencode-ai/sdk"
import { parseArgs } from "util"
@@ -49,7 +50,7 @@ Examples:
}
parts.push({
type: "file",
url: `file://${resolved}`,
url: pathToFileURL(resolved).href,
filename: path.basename(resolved),
mime: "text/plain",
})