From 42ad8645010910df51cad51fab77edd5cafdaf91 Mon Sep 17 00:00:00 2001 From: Roger Deng <13251150+rogerdigital@users.noreply.github.com> Date: Thu, 7 May 2026 17:04:27 +0800 Subject: [PATCH] fix(cli): detect MIME type for --file flag instead of hardcoding text/plain The --file flag on `opencode run` was sending all non-directory attachments as text/plain, breaking multimodal support for images, PDFs, and other binary files. Use Filesystem.mimeType() to detect the correct type from the file extension. Closes #16723, #24698, #25353 --- packages/opencode/src/cli/cmd/run.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/opencode/src/cli/cmd/run.ts b/packages/opencode/src/cli/cmd/run.ts index a05b273e4489..56c406f6850f 100644 --- a/packages/opencode/src/cli/cmd/run.ts +++ b/packages/opencode/src/cli/cmd/run.ts @@ -333,7 +333,7 @@ export const RunCommand = effectCmd({ process.exit(1) } - const mime = (await Filesystem.isDir(resolvedPath)) ? "application/x-directory" : "text/plain" + const mime = (await Filesystem.isDir(resolvedPath)) ? "application/x-directory" : await Filesystem.mimeType(resolvedPath) files.push({ type: "file",