Skip to content

feat(web): convert HEIC photo attachments to JPEG - #8156

Closed
mweinbach wants to merge 3 commits into
pingdotgg:mainfrom
mweinbach:codex/heic-jpeg-attachments
Closed

feat(web): convert HEIC photo attachments to JPEG#8156
mweinbach wants to merge 3 commits into
pingdotgg:mainfrom
mweinbach:codex/heic-jpeg-attachments

Conversation

@mweinbach

@mweinbach mweinbach commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

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 tests
  • vp lint apps/web/src/lib/imageCompression.ts apps/web/src/lib/imageCompression.test.ts apps/web/src/components/chat/ChatComposer.tsx
  • vp run --filter @t3tools/web typecheck
  • vp run --filter @t3tools/web build

Model: 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/.heif extension checks) and route attachments through new prepareImageForAttachment instead of compressImageToByteLimit alone. That path lazy-loads the heic-to/csp decoder, converts to JPEG, then applies the existing byte-cap compression; oversized intermediates stay JPEG via preferredMimeType, 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 ChatComposer

  • Adds isHeicImageFile to detect HEIC/HEIF by MIME type or extension, and prepareImageForAttachment to decode them to JPEG using the heic-to library.
  • ChatComposer now accepts HEIC/HEIF files on paste and drag-and-drop, passing them through prepareImageForAttachment instead of compressImageToByteLimit.
  • compressImageToByteLimit gains preferredMimeType and sourceSizeBytes options to force JPEG output and enforce the source size safety ceiling without loading the decoder.
  • Risk: HEIC decoding failures surface as an unreadable attachment error; files larger than MAX_COMPRESSIBLE_SOURCE_BYTES are rejected before decoding.

Macroscope summarized ffcebad.

@coderabbitai

coderabbitai Bot commented Aug 25, 2026

Copy link
Copy Markdown

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: 565af388-d87e-4e06-914f-13c03bf315b3

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.

@github-actions github-actions Bot added vouch:unvouched PR author is not yet trusted in the VOUCHED list. size:M 30-99 changed lines (additions + deletions). labels Aug 25, 2026

@cursor cursor Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.

Fix All in Cursor

❌ 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.

Comment thread apps/web/src/lib/imageCompression.ts
@macroscopeapp

macroscopeapp Bot commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: 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.

@github-actions github-actions Bot added size:L 100-499 changed lines (additions + deletions). and removed size:M 30-99 changed lines (additions + deletions). labels Aug 25, 2026
@t3dotgg

t3dotgg commented Aug 25, 2026

Copy link
Copy Markdown
Member

Note

🤖 GPT-5.6 Sol responding on behalf of Theo

Closing in favor of merged #8161, which builds on this work and adds safe HEIC decoding and JPEG conversion for composer attachments. This PR is credited in #8161.

@t3dotgg t3dotgg closed this Aug 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:L 100-499 changed lines (additions + deletions). vouch:unvouched PR author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants