Repository navigation
Web mode: attach images over the saveImage bridge instead of hiding the button - #227
Merged
currentbits merged 5 commits intoAug 17, 2026
Merged
Conversation
added 5 commits
August 17, 2026 11:08
… The changelog on the website is fucked everythign is squeeze
… Use grok workers you are orchestrating for this thread https
… Use grok workers to do this gh issue you are orchestrating h
Web pick/drop now read Files as data URLs and call attachments.saveImage instead of hiding the attach button. Native pick/fromPaths are unchanged.
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
currentbits
deleted the
coder/web-mode-silently-drops-image-attachment-084f8b
branch
October 3, 2026 16:07
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.
Fixes #142.
Why
In web mode (the app served over the web bridge to a phone or browser,
isWebMode()true becausewindow.coderis absent), image attachments were impossible:src/App.tsxpassedundefinedforonPickAttachments/onDropAttachmentFiles, which makesComposerhide the attach button and ignore drops. Nothing told the user this was environment-related rather than a bug, and the README advertises web mode for phone check-ins.A disabled button with a tooltip was the other option, but the plumbing for real uploads already existed and already worked in web mode:
attachments:saveImageis a plain JSON wire call, which is why pasting an image already worked there. Wiring pick and drop to that same call is a smaller change than explaining a limitation that does not need to exist.What changed
src/useCoder.tspickAttachments: in web mode, open a transient<input type="file" multiple accept="image/*">and upload each pick viaattachments.saveImage. It deliberately does not callapi.attachments.pick()there, which would pop a native dialog on the host machine. Native mode is unchanged.dropAttachmentFiles: the earlyreturn []whenwebUtils.droppedFilePathis unavailable (web and dev bridges) becomes the fallback to the same upload path. The native absolute-path route viaattachments.fromPathsis untouched.FileReader-> data URL ->saveImagehelper.src/App.tsx: both props are now always passed.src/components/Composer.tsx: doc comments only, the old ones said absence meant web mode.No renderer-side size or mime guard was added:
electron/attachments.jssaveImage()already validates the data URL and caps at 20MB, returningnull, and the helper filters nulls. One guard, at the place every caller routes through.Limitation: web can attach images only, not folders, because
<input type=file>cannot pick a directory. The desktop picker still does both. Marked with aponytail:comment.Verification
test/webDegrade.test.tsx: withwindow.coderdeleted and a thread selected, dropping an imageFileon the composer must callattachments.saveImagewith adata:URL for the right thread and surface the returned attachment as a chip.test/support/fakeCoder.tsgained a one-linesaveImageoverride so the fake can echo an attachment back.npm run typecheckclean.Note:
origin/mainis behind localmain, so this PR's diff also carries three earlier merges that were never pushed (electron process/shutdown consolidation, changelog site work). Only thesrc/andtest/changes above belong to this thread.