mirror of
https://github.com/anomalyco/opencode.git
synced 2026-04-29 04:59:51 +00:00
fix: properly encode file URLs with special characters (#12424)
This commit is contained in:
parent
e9a3cfc083
commit
fde0b39b7c
12 changed files with 114 additions and 22 deletions
|
|
@ -1,4 +1,5 @@
|
|||
import { createOpencodeClient, createOpencodeServer } from "@opencode-ai/sdk"
|
||||
import { pathToFileURL } from "bun"
|
||||
|
||||
const server = await createOpencodeServer()
|
||||
const client = createOpencodeClient({ baseUrl: server.url })
|
||||
|
|
@ -17,7 +18,7 @@ for await (const file of input) {
|
|||
{
|
||||
type: "file",
|
||||
mime: "text/plain",
|
||||
url: `file://${file}`,
|
||||
url: pathToFileURL(file).href,
|
||||
},
|
||||
{
|
||||
type: "text",
|
||||
|
|
@ -41,7 +42,7 @@ await Promise.all(
|
|||
{
|
||||
type: "file",
|
||||
mime: "text/plain",
|
||||
url: `file://${file}`,
|
||||
url: pathToFileURL(file).href,
|
||||
},
|
||||
{
|
||||
type: "text",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue