feat(desktop): multi-select in the paperclip file picker#551
Merged
Conversation
The 📎 paperclip button only accepted one file at a time even though drag-drop and paste already handle multi-file uploads. Switch the Tauri file dialog from `pick_file` to `pick_files` and process each picked path through the existing TOCTOU-safe pipeline (fd pin → sniff → transcode-or-passthrough → MIME validation → upload). Rust: - Extract the per-file pipeline into `process_picked_path` so `pick_and_upload_media` can call it once per selected path. The fd-pinning / transcode / poster-upload behaviour is preserved verbatim per file. - Command return type is now `Vec<BlobDescriptor>` (empty on cancellation). Uploads run sequentially; if one fails, the command returns its error and earlier uploads are not rolled back (they're already content-addressed on the relay). TS: - `pickAndUploadMedia` returns `BlobDescriptor[]`. - `handlePaperclip` appends each descriptor through the existing slot system. Spinner count is incremented once at click time and decremented once when the dialog + uploads return, matching the previous UX. Signed-off-by: tlongwell-block <109685178+tlongwell-block@users.noreply.github.com>
93baca5 to
97ad60a
Compare
wesbillman
approved these changes
May 12, 2026
This was referenced May 28, 2026
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.
Why
Drag-drop and paste already handle multiple files (
handleDrop/handlePasteinuseMediaUpload.ts), but the 📎 paperclip buttonopens
pick_file(singular) so users can only attach one at a time.Mentioned on the May 12 standup.
What
Switch the Tauri file dialog to
pick_files(plural — alreadyavailable in
tauri-plugin-dialogv2.7) and process each picked paththrough the existing TOCTOU-safe pipeline.
Rust (
desktop/src-tauri/src/commands/media.rs)process_picked_pathsopick_and_upload_mediacan call it once per selected path. Thefd-pinning / transcode / poster-upload behaviour is preserved
verbatim per file.
Vec<BlobDescriptor>(empty oncancellation). Uploads run sequentially; if one fails, the command
returns the error for that file and earlier successes are not rolled
back — they're already content-addressed on the relay.
TS
desktop/src/shared/api/tauri.ts—pickAndUploadMediareturnsBlobDescriptor[].desktop/src/features/messages/lib/useMediaUpload.ts—handlePaperclipappends each returned descriptor through theexisting slot system. Spinner count is incremented once at click and
decremented once when uploads return, matching the previous UX.
Verification
just desktop-tauri-check— passes.just desktop-tauri-fmt-check— passes.just desktop-check(Biome + file-size guard) — passes (media.rsis 719 lines, override is 720).
just desktop-typecheck— passes.just desktop-build— passes.node --test useMediaUpload.test.mjs— 10/10 pass.Risk
Moderate. The Rust API surface for
pick_and_upload_mediachangesshape (Option → Vec); the only TS caller is updated in the same
PR. The security-critical fd-pinning pattern is preserved per file.
Sequential upload semantics keep the error-handling model simple.