From 18d104c92efff9ff0f7c471483fde5034c3ef428 Mon Sep 17 00:00:00 2001 From: Abdi Ibrahim Date: Fri, 6 Feb 2026 20:01:10 -0500 Subject: [PATCH] fix(desktop): windows clipboard images come thru as data not file --- packages/opencode/src/session/prompt.ts | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/packages/opencode/src/session/prompt.ts b/packages/opencode/src/session/prompt.ts index 6113856cc60..fbcb23ff979 100644 --- a/packages/opencode/src/session/prompt.ts +++ b/packages/opencode/src/session/prompt.ts @@ -974,7 +974,20 @@ export namespace SessionPrompt { log.info("file", { mime: part.mime }) // have to normalize, symbol search returns absolute paths // Decode the pathname since URL constructor doesn't automatically decode it - const filepath = fileURLToPath(part.url) + let filepath: string | undefined + try { + filepath = fileURLToPath(part.url) + } catch (error) { + log.warn("non-file url in file part", { url: part.url, error }) + return [ + { + id: part.id ?? Identifier.ascending("part"), + messageID: info.id, + sessionID: input.sessionID, + ...part, + }, + ] + } const stat = await Bun.file(filepath) .stat() .catch(() => undefined)