fix: route dropped files by type (photo/video/document, not sticker) — v0.4.2#8
Merged
Merged
Conversation
…s stickers) v0.4.1 injected dropped files into the first input[type=file] it found. But WhatsApp Web keeps a sticker-creator input (image-only accept) permanently mounted, while the real 'Photos & videos' input (accept includes video) and 'Document' input (accept='*') are mounted ONLY when the attach (+) menu is opened. So every drop hit the sticker input: images became stickers, video showed 'not supported', and zips/docs were silently dropped. Fix: route by file type. Classify each file (image or mp4/3gpp/quicktime -> media; everything else incl. webm/mkv/zip/pdf -> document), open the attach menu to mount the correct input, then select it by accept (media = accept contains a video type; document = accept '*' / no image+video) and set .files + fire change. The sticker input is never targeted. Verified end-to-end on live WhatsApp Web (image->photo, mp4->video, README.md/zip->document). Routing logic also checked against a mock DOM in real webkit2gtk 2.52. Known minor cosmetic: the attach menu briefly flashes open during mount. Release v0.4.2. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem (reported on v0.4.1)
Drag-and-drop attached every file wrongly:
Root cause
v0.4.1 injected into the first
input[type=file]found. But WhatsApp Web keeps a sticker-creator input (image-onlyaccept) permanently mounted, while the real Photos & Videos input (acceptincludes video) and Document input (accept="*") are mounted only when the attach (+) menu is opened. So every drop landed on the sticker input — which turns images into stickers and rejects video/documents.Fix — route by type (
bridge.js)image/*or native video (mp4/3gpp/quicktime) → media; everything else (webm/mkv/avi, zip, pdf, docs) → document.accept(media =acceptcontains a video type; document =accept="*"/ no image+video) — never the sticker input..files+ firechange(React'sonChangefires for synthetic bubbling events).Verification
.mp4→ video preview,README.md/zip → document send dialog. (Screenshot-confirmed real sends.)cargo build --locked+cargo test --locked→ 51/51;node --checkon bridge.js; boots clean. CI covers Windows + macOS.Known minor cosmetic: the attach menu briefly flashes open during mount (the inputs only exist while it's open).
Releases as v0.4.2.
🤖 Generated with Claude Code