fix(cli): detect MIME type for --file flag instead of hardcoding text/plain#24933
Open
rogerdigital wants to merge 3 commits intoanomalyco:devfrom
Open
fix(cli): detect MIME type for --file flag instead of hardcoding text/plain#24933rogerdigital wants to merge 3 commits intoanomalyco:devfrom
rogerdigital wants to merge 3 commits intoanomalyco:devfrom
Conversation
Contributor
|
Thanks for updating your PR! It now meets our contributing guidelines. 👍 |
Bojun-Vvibe
added a commit
to Bojun-Vvibe/oss-contributions
that referenced
this pull request
Apr 29, 2026
- anomalyco/opencode#24933 merge-after-nits: --file MIME detection fix - anomalyco/opencode#24935 request-changes: in-tree pet+CAVA bundle, ship as plugin only - openai/codex#20176 merge-after-nits: SessionSource via JSON deserialize is brittle - openai/codex#20178 merge-as-is: 1714-line obsolete adapter deletion
Author
|
One behavior change worth noting: unknown file extensions now fall back to |
e5df3c6 to
aab5d6b
Compare
aab5d6b to
845067f
Compare
6 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue for this PR
Closes #24698
Type of change
What does this PR do?
The
--fileflag inopencode runalways hardcodedtext/plainas the MIME type, which prevented image files from being recognized as multimodal inputs by LLMs.The fix replaces the hardcoded
"text/plain"with a call to the existingFilesystem.mimeType()utility, which uses themime-typeslibrary to look up the correct MIME type from the file extension. For example,.png→image/png,.jpg→image/jpeg, unknown extensions →application/octet-stream.One-line change in
packages/opencode/src/cli/cmd/run.ts:331.How did you verify your code works?
bun turbo typecheck)Filesystem.mimeType()function already exists and is used elsewhere in the codebase (e.g.file/index.ts,project/project.ts)Screenshots / recordings
N/A — CLI behavior change, no UI involved.
Checklist