Skip to content

Commit 42ad864

Browse files
committed
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 anomalyco#16723, anomalyco#24698, anomalyco#25353
1 parent 30c4fcb commit 42ad864

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

  • packages/opencode/src/cli/cmd

‎packages/opencode/src/cli/cmd/run.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,7 @@ export const RunCommand = effectCmd({
333333
process.exit(1)
334334
}
335335

336-
const mime = (await Filesystem.isDir(resolvedPath)) ? "application/x-directory" : "text/plain"
336+
const mime = (await Filesystem.isDir(resolvedPath)) ? "application/x-directory" : await Filesystem.mimeType(resolvedPath)
337337

338338
files.push({
339339
type: "file",

0 commit comments

Comments
 (0)