Skip to content

[loop cycle 5] fix(dnd): route AVIF/HEIF photos as photos; broaden MIME labels#13

Merged
karem505 merged 1 commit into
masterfrom
whatrust-loop/cycle-5-mime-routing
Jun 28, 2026
Merged

[loop cycle 5] fix(dnd): route AVIF/HEIF photos as photos; broaden MIME labels#13
karem505 merged 1 commit into
masterfrom
whatrust-loop/cycle-5-mime-routing

Conversation

@karem505

Copy link
Copy Markdown
Owner

What

A drag-and-drop routing fix. mime_for() decides how a dropped file is attached: bridge.js sends an image/* MIME to the Photos & Videos composer and everything else to the Document composer. Modern phone photos in AVIF and HEIF were falling through to application/octet-stream, so they got attached as files instead of photos.

How

  • avif → image/avif, heif → image/heif (alongside the existing heic) → they now route as photos.
  • Deliberately conservative: niche raster formats (TIFF, ICO, APNG) are left as documents. WhatsApp's photo composer may reject them, and a rejected media attach ("not supported") is worse than the current behavior of sending them as a document file. A test pins this.
  • Correct labels added for many video (3g2, mpeg/mpg, mts/m2ts, ogv, flv), audio (flac, aac, weba, amr, mid/midi), and document/archive (rtf, odt/ods/odp, epub, md, json, xml, 7z, rar, tar, gz, apk) types. None are images or in the native-video set, so routing is unchanged — only the label improves (e.g. WhatsApp can render an audio preview).

Verification

Gate 1 — cargo build --locked + cargo test: PASS, 53 tests (2 new):

  • modern_image_types_resolve_to_image_so_they_route_as_photos — avif/heif/heic → image/*; tiff/ico/apng stay octet-stream (document).
  • new_av_and_doc_types_have_specific_labels — flac/aac/mpeg/md/json/7z/epub labels + unknown-fallback.

Gate 2 — generation-blind code review: APPROVE, severity none, no must-fix. Confirmed: no duplicate/unreachable arms; all MIME strings IANA/de-facto correct; routing-regression check clean (only avif/heif newly enter the media path, both supported); parsing normalizes correctly; the TIFF/ICO/APNG holdback is the right call.


🤖 PR-ONLY — do not auto-merge. Releasing whatRust is manual via a v* tag; this loop never merges, bumps the version, or tags a release. Opened by the whatrust-fix-loop (cycle 5/6).

mime_for() drives how bridge.js routes a dropped file: an image/* MIME goes to the
Photos & Videos composer, anything else to the Document composer. Modern phone photos
in AVIF and HEIF fell through to application/octet-stream, so they were attached as
plain files instead of photos. Map avif -> image/avif and heif -> image/heif (alongside
the existing heic) so they route as photos.

Conservatively, niche raster formats (TIFF, ICO, APNG) are deliberately left as
documents: WhatsApp's photo composer may reject them, which would be worse than the
current behaviour of sending them as a document file.

Also add correct labels for many video (3g2, mpeg/mpg, mts/m2ts, ogv, flv), audio
(flac, aac, weba, amr, mid/midi), and document/archive (rtf, odt/ods/odp, epub, md,
json, xml, 7z, rar, tar, gz, apk) types. These all still route as documents (none are
images or in the small native-video set), so labeling improves but routing is unchanged.

Tests: avif/heif/heic resolve to image/*; tiff/ico/apng stay octet-stream (document);
the new av/doc labels resolve; unknown extensions still fall back so the file always sends.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016o9cWBaPy4zU4BAurUVoTp
@karem505 karem505 merged commit c30544b into master Jun 28, 2026
6 checks passed
karem505 added a commit that referenced this pull request Jun 28, 2026
Bundles six loop-shipped fixes:
- perf(dnd): stream dropped files as base64 to cut peak memory on large videos (#9)
- fix(notifications): forward service-worker showNotification to the native toast (#10)
- feat(calls): expose a minimal window.chrome so WhatsApp enables call buttons (#11)
- fix(notifications): de-duplicate burst-repeated native toasts (#12)
- fix(dnd): route AVIF/HEIF photos as photos; broaden MIME labels (#13)
- fix(calls/capability): return a complete Chrome high-entropy client-hints set (#14)
Plus integration: SW notifications share the dedup window; base64_encode is test-only now.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016o9cWBaPy4zU4BAurUVoTp
@karem505 karem505 deleted the whatrust-loop/cycle-5-mime-routing branch June 28, 2026 01:38
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.

1 participant