Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(web): reject unsupported composer image types at attach time #6574

Mergedmdshzb04(GitHub profile, opens in a new tab)merged 1 commit intomain fromrefs/pull/6574/headmerged by juliusmarminge View on GitHub

Summary

Pasting or dropping an SVG (or other non-raster image) into the composer looked like it worked — the preview showed up — but sending the message failed with Unsupported Claude image attachment type 'image/svg+xml'.

This adds a shared supported-mime check in contracts and uses it when images are attached on web and mobile, so unsupported types are rejected immediately with a clear error instead of failing mid-turn.

What changed

  • packages/contracts: exported the supported turn image mime list and a small helper
  • apps/web: ChatComposer rejects unsupported types before compression/preview
  • apps/mobile: same validation in the image picker and incoming share flow

Why

Fixes #6020. Matches the issue reporter’s acceptable outcome: fail at paste/drop time like other unsupported file types, rather than after the image is already in the thread.

Test plan

  • vp test run packages/contracts/src/orchestration.test.ts
  • vp run --filter @t3tools/contracts typecheck
  • vp run --filter @t3tools/web typecheck
  • Paste/drop an SVG in the web composer → inline error, no preview chip
  • Paste/drop PNG/JPEG/WebP/GIF → still works

Note

Low Risk Client-side validation only; tightens attach UX to match existing server/provider rules with no auth or data-path changes.

Overview Composer image attach paths now reject types the provider cannot send on a turn (e.g. SVG), instead of showing a preview and failing when the message is sent.

Contracts export PROVIDER_SEND_TURN_SUPPORTED_IMAGE_MIME_TYPES (GIF, JPEG, PNG, WebP) and isProviderSendTurnSupportedImageMimeType, with a small unit test.

Web ChatComposer runs that check after the generic image/* gate and before compression, surfacing an inline error that names the allowed formats.

Mobile applies the same rule in the image library picker and when building drafts from the incoming share flow, skipping bad items with a warning or error as appropriate.

Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit 93376e451b586068ba73b64ea991f586e5af51b5. Bugbot is set up for automated code reviews on this repo. Configure [here](https://www.cursor.com/dashboard/bugbot).

Note

Reject unsupported image mime types at composer attach time

  • Adds isProviderSendTurnSupportedImageMimeType to packages/contracts/src/orchestration.ts, which checks a normalized mime type against a supported set (GIF, JPEG, PNG, WebP).
  • The web ChatComposer, mobile pickComposerImages, and incoming share draft builder each call this guard and skip unsupported files (e.g. SVG) with a user-facing error naming acceptable formats.
  • Behavioral Change: files with unsupported mime types that were previously accepted silently are now rejected with an error message at attach time.
Macroscope summarized 93376e4.
    1. coderabbitai[bot](GitHub profile, opens in a new tab)commented

      Important

      Review skipped

      Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

      ⚙️ Run configuration

      Configuration used: Repository UI

      Review profile: CHILL

      Plan: Pro Plus

      Run ID: 3b68e7f2-d426-4f1b-aa2e-46ccbe0cdf57

      You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

      Use the checkbox below for a quick retry:

      • 🔍 Trigger review

      Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

      ❤️ Share
      Comment `@coderabbitai help` to get the list of available commands.
    2. github-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:unvouched

    3. Approvability

      Verdict: Approved 5435e7c

      Straightforward bug fix adding early validation to reject unsupported image types (SVG, etc.) at attach time with clear error messages. Self-contained change with test coverage, following existing validation patterns.

      You can customize Macroscope's approvability policy. [Learn more](https://docs.macroscope.com/approvability#example-custom-eligibility-rules).
    4. juliusmarminge merged this34a12bc

    5. juliusmarminge closed this

Sign in to join this conversation.