feat(web): convert HEIC photo attachments to JPEG - #8156
Conversation
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
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. Comment |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Want fixes drafted automatically? Bugbot Autofix can create code changes for findings. A team admin can enable Autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit d30992f. Configure here.
ApprovabilityVerdict: Not approved Macroscope's review found this PR not approvable — This PR adds a new browser-side HEIC/HEIF decoding dependency and changes attachment validation, preprocessing, previews, and uploaded payloads. The user-facing workflow and associated runtime processing are substantial enough to require human review. You can add or adjust custom eligibility rules. Learn more. |

HEIC and HEIF photos currently fail composer attachment validation, and Chromium-based clients cannot decode them natively.
Convert dropped and pasted HEIC/HEIF photos to JPEG before upload, recognize photos whose browser MIME type is missing, preserve JPEG output when oversized images need compression, and lazy-load a CSP-compatible decoder. Document the behavior for web and desktop users.
Verification:
vp test run apps/web/src/lib/imageCompression.test.ts apps/web/src/components/chat/workspaceFileDrop.test.ts— 22 passing testsvp lint apps/web/src/lib/imageCompression.ts apps/web/src/lib/imageCompression.test.ts apps/web/src/components/chat/ChatComposer.tsxvp run --filter @t3tools/web typecheckvp run --filter @t3tools/web buildModel: gpt 5.6 sol
Harness: Codex
Note
Medium Risk
Changes the composer attachment pipeline and adds client-side HEIC decoding; existing size and unreadable-error behavior is preserved but new decoder failures surface as attachment errors.
Overview
Enables HEIC/HEIF photos in the message composer by converting them to JPEG before upload, since providers and many browsers cannot use those formats directly.
Composer drag-and-drop and paste now treat HEIC/HEIF as images (including files with empty or generic MIME types via
.heic/.heifextension checks) and route attachments through newprepareImageForAttachmentinstead ofcompressImageToByteLimitalone. That path lazy-loads theheic-to/cspdecoder, converts to JPEG, then applies the existing byte-cap compression; oversized intermediates stay JPEG viapreferredMimeType, and the original HEIC size still gates the 50MB decode-safety limit even when conversion inflates the blob.User-facing copy and docs now list HEIC/HEIF among supported formats and note automatic conversion on web/desktop.
Reviewed by Cursor Bugbot for commit ffcebad. Bugbot is set up for automated code reviews on this repo. Configure here.
Note
Convert HEIC photo attachments to JPEG in
ChatComposerisHeicImageFileto detect HEIC/HEIF by MIME type or extension, andprepareImageForAttachmentto decode them to JPEG using theheic-tolibrary.ChatComposernow accepts HEIC/HEIF files on paste and drag-and-drop, passing them throughprepareImageForAttachmentinstead ofcompressImageToByteLimit.compressImageToByteLimitgainspreferredMimeTypeandsourceSizeBytesoptions to force JPEG output and enforce the source size safety ceiling without loading the decoder.unreadableattachment error; files larger thanMAX_COMPRESSIBLE_SOURCE_BYTESare rejected before decoding.Macroscope summarized ffcebad.