feat(web): safely attach HEIC photos as JPEG images - #8161
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 |
Thread transfer impact✅ Thread transfer remains within every enforced ceiling.
Baseline: Scenario and decoded snapshot size10 historical turns, 5 command tools per turn, 878.9 KiB retained MCP result per historical turn, and a 1.05 MiB retained result in the measured turn.
Updated in place by a trusted workflow. PR artifacts are strictly validated and never executed. |
ApprovabilityVerdict: Not approved Macroscope's review found this PR not approvable — This introduces a new HEIC/HEIF attachment workflow with a third-party client-side decoder, metadata validation, JPEG conversion, and changed upload behavior. The browser-side decoding and resource usage make this a substantive runtime feature requiring human review. You can add or adjust custom eligibility rules. Learn more. |
ce05f43 to
eaa7b1c
Compare
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.
Reviewed by Cursor Bugbot for commit eaa7b1c. Configure here.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
## What's Changed * feat(web): settle and restore threads with a keyboard shortcut by @t3dotgg in pingdotgg/t3code#8089 * perf(desktop): cut macOS signing calls by 81% by @t3dotgg in pingdotgg/t3code#8093 * feat: link pull requests to threads by @t3dotgg in pingdotgg/t3code#8160 * feat(web): safely attach HEIC photos as JPEG images by @t3dotgg in pingdotgg/t3code#8161 **Full Changelog**: pingdotgg/t3code@v0.0.34-nightly.20260825.1181...v0.0.34-nightly.20260825.1182 Upstream release: https://github.com/pingdotgg/t3code/releases/tag/v0.0.34-nightly.20260825.1182

HEIC and HEIF photos cannot be attached in the web or desktop composer. Browsers also reject some otherwise valid images when a misleading
.heicfilename overrides their actual MIME type.Convert dropped and pasted HEIC photos to JPEG, compress JPEG intermediates that grow beyond the original source limit, and trust concrete image MIME types before falling back to a HEIC filename. Full-resolution 24 MP and 48 MP photos remain supported. Based on #8156.
Verification:
vp test run apps/web/src/lib/imageCompression.test.ts apps/web/src/components/chat/workspaceFileDrop.test.ts(23 passing tests)vp 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 typecheckModel: GPT-5.6 Sol
Harness: Codex
Note
Medium Risk
Client-side HEIC decode and re-encode runs on user-selected files with OOM guards, but malformed metadata or decoder failures surface as attachment errors; new dependency loads only when HEIC is attached.
Overview
Enables HEIC/HEIF photos in the web composer on paste and drag by converting them to JPEG before upload, since providers do not accept Apple’s format.
prepareImageForAttachmentdetects HEIC via MIME or extension (including empty/octet-streamfrom Finder), parses ISO BMFF metadata to reject unsafe dimensions before loadingheic-to, converts to JPEG, then reuses the existing byte-limit compression with JPEG forced and source-size checks so bloated JPEG intermediates do not bypass the 50MB decode ceiling.ChatComposerroutes attachments through this pipeline and updates validation/error copy; user docs note automatic conversion.Adds
heic-to@^1.5.2and unit tests for detection, conversion, compression, and early rejection paths.Reviewed by Cursor Bugbot for commit 1a9d391. Bugbot is set up for automated code reviews on this repo. Configure here.
Note
Add HEIC photo conversion to JPEG for web composer attachments
prepareImageForAttachmentto detect HEIC/HEIF files (including those with missing MIME types), validate ISO BMFF metadata for dimensions, and convert them to JPEG via theheic-tolibrary before compressioncompressImageToByteLimitwith optionalpreferredMimeTypeto force JPEG output andsourceSizeBytesto enforce the original source file size limit during conversionvalidateHeicImageDimensionsrejects HEICs with missing or corrupt ISO BMFF metadata, or those exceedingMAX_HEIC_DECODE_PIXELS, as unreadable instead of attempting to decodeMacroscope summarized 1a9d391.