Skip to content

fix(ai): accept case-insensitive image MIME types in Cohere - #58944

Closed
clean99 wants to merge 1 commit into
anomalyco:devfrom
clean99:cohere-image-mime
Closed

clean99 wants to merge 1 commit into
anomalyco:devfrom
clean99:cohere-image-mime

Conversation

@clean99

@clean99 clean99 commented Oct 25, 2026

Copy link
Copy Markdown

Issue for this PR

Closes #58937

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

Use the media asset's normalized image kind when lowering Cohere user messages. The case-sensitive MIME prefix check rejected IMAGE/PNG even though the asset is an image and sibling routes accept it.

How did you verify your code works?

bun run check from the root; bun run test, bun typecheck, and bun run typecheck:tsc from packages/ai. The regression covers inline and URL images with lowercase, uppercase and mixed-case MIME types: bun run test test/provider/cohere.test.ts.

Screenshots / recordings

Not a UI change.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

@opencode-agent opencode-agent Bot closed this Oct 25, 2026
@opencode-agent

Copy link
Copy Markdown
Contributor

Thanks for picking this up, and for the regression test covering both inline and URL images!

I think this duplicates #58943, which was opened a little earlier for the same issue (#58937). It makes the same one-line change in packages/ai/src/protocols/cohere-chat.ts (part.media.kind === "image") and has matching case-insensitive tests. If you think something is missing there, reviewing or testing it, or leaving a comment on #58943, would be very welcome.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Cohere route rejects image MIME types with uppercase letters

1 participant