mirror of
https://gitee.com/zhangsken/opencode.git
synced 2026-10-16 10:30:01 +08:00
fix(app): use HTTP-safe UUID for attachment uploads
This commit is contained in:
committed by
opencode-agent[bot]
parent
39e1ce55bc
commit
44287069e4
@@ -2,6 +2,7 @@ import type { Accessor } from "solid-js"
|
||||
import { useServer } from "@/runtime/server/current"
|
||||
import { useServerSDK } from "@/runtime/server/client"
|
||||
import { authTokenFromCredentials } from "@/runtime/server/api"
|
||||
import { uuid } from "@/runtime/persistence/uuid"
|
||||
import { useWorkspaceLocation } from "@/workspaces/location"
|
||||
import type { ComposerControls } from "../adapter"
|
||||
|
||||
@@ -28,7 +29,7 @@ export function useAttachmentDestination(controls: Accessor<ComposerControls>) {
|
||||
// normalizes the separators and returns the resolved path.
|
||||
const url = new URL("/api/experimental/fs/write", server.conn.http.url)
|
||||
url.searchParams.set("location[directory]", location().directory)
|
||||
url.searchParams.set("path", `${info.paths.tmp}/uploads/${crypto.randomUUID()}/${file.name}`)
|
||||
url.searchParams.set("path", `${info.paths.tmp}/uploads/${uuid()}/${file.name}`)
|
||||
return write(url, file, server.conn.http.password, report, signal)
|
||||
},
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user