Repository navigation
fix(email): retain files in attachment and inline-image pickers - #6935
Merged
alteixeira20 merged 5 commits intoOct 30, 2026
Merged
Conversation
alteixeira20
approved these changes
Oct 30, 2026
alteixeira20
left a comment
Collaborator
There was a problem hiding this comment.
Thanks @redpersongpt for this important fix.
Summary:
- Defect Resolution: Confirmed. Converting file picker inputs into an array prior to resetting the input value prevents the browser from clearing the live
FileListbefore asynchronous upload processing completes. - Safety & Isolation: Shallow copying preserves
Fileblob references for asynchronous dispatch while enabling users to immediately re-select the same file. - Compatibility: Integrates cleanly with current
dev(0e49c4ef) and passes syntax verification acrossstatic/js/document.js. - Validation: Verified with 8 Playwright headless Chromium tests exercising the upload event handlers and input reset, 37 focused tests in 4.64s, and 529 email suite tests passing in 25.36s.
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.
Summary
The email paperclip handler retained the input's live
FileList, then reset the input before handing the files to the uploader. That reset emptied the list, so choosing files produced no upload while drag-and-drop still worked. Snapshot the files before resetting the input in both the attachment and inline-image handlers. The input still resets so selecting the same file again works.Target branch
devin the public repository.mainremains release-curated.Linked Issue
Fixes #2227.
Part of #2271: the shared inline-image picker has the same live-list reset bug. Its repair is included here, with actual email rich-body image validation; regular Markdown and other document-format insertion semantics are unchanged and were not separately validated.
Earlier #2258 closed in favor of #2296; #2296 was later approved but is closed without merge. Current
devstill contains the live-FileList/reset sequence. This carries the narrow email selection fix, without adding the document image-insertion features discussed in that older review. Current open/closed PR searches found no equivalent open fix; #6019's gallery changes do not modify this handler.Type of Change
Checklist
dev).AI assistance was used. The non-agent attestation below is intentionally unchecked.
How to Test
With Node dependencies and Chromium installed:
Original validation: 111 passed, one existing SQLAlchemy deprecation warning. All eight modified JavaScript files were syntax checked. Eight new browser cases execute both actual handlers extracted with the repository's document-source helper, using Chromium's native file input and real
Fileobjects. Single/multiple/repeated attachment selection fail on the original57a1859base; the same three inline-image cases fail before the follow-up fix. Empty selection already passes for both. The uploader boundaries record names and SHA-256 hashes of real repository PNG fixtures, without replacingFileListwith a mock. All cases verify the input reset is retained.Full-app verification at 1440/390 px:
/api/email/compose-upload, successful filename/size metadata and a visiblepaperclip-example.txtchip.The after drafts were opened through the running app's public
documentModule.openEmailDraftentry point; paperclip/menu/chooser/upload/rendering remained actual app behavior. On mobile, the existing email-fields toggle exposes the attachment chip. Initial harness setup used the received-attachment container instead of the compose container, and encountered sidebar/short-navigation timing issues; those attempts are not passing evidence. The final runs use the correct compose container, real field toggle and a cold-load navigation timeout of 60 seconds. No force-click or CSS override was used.The app was stopped before changing production source and restarted afterward, then stopped again; temporary dependencies were removed. Limits: native macOS/Python/Chromium, no Windows, Docker, SMTP delivery, model inference or full repository suite. Optional vector services ran degraded. Backend upload limits, storage, authorization and drag-and-drop are unchanged.
Upstream refresh — 29 October 2026
Merged current
devat8b8fc62449057888e20c74314b8e2924a6c02adf. Kept the current upstream network-first worker and removed obsolete cache-only/query-version churn where applicable; the production behavior fix is retained. 116 focused tests passed after the merge, with the existing SQLAlchemy deprecation warning. Changed JS files passed syntax checks and the merge diff passed whitespace checks. Original full-app evidence predates this upstream UI refresh; no new full-app run was performed for this mechanical merge.CI fixture follow-up
The refreshed shard also needed the shared photo-routing fixture to explicitly exclude unrelated external MCP registry state. Its routing assertions and production code are unchanged. The file-picker checks plus photo-family/cache checks passed 145 tests after this test-only correction.
Visual / UI changes
Screenshots / clips
Immutable evidence-only fork images are outside the code diff. The file is deliberately tiny, so the existing size formatter shows 0 KB; the API and stored bytes were verified as 43 bytes.
Shared inline-image picker validation
The same reset bug was also reproduced through the real inline-image toolbar and native chooser in the email rich-body editor. Before: selecting a valid repository PNG triggered “Choose an image file”, zero
/api/uploadPOSTs and no inserted image. After: one real upload, a rendered image with natural width 192, and bytes read back over authenticated HTTP identical to the selected fixture, at both widths with no page errors. This is part of the same PR; the count is unchanged. The module version and service-worker cache were bumped again for this follow-up.CI cache-identity follow-up
The first follow-up CI run found two existing tests pinned to the old document-module cache token. Their expectations now match the new token. All 14 tests in the two affected files plus module-version parity pass locally; the 111-test browser/security run above predates this test-only adjustment.