Skip to content

feat: send any file - #7

Merged
nerdstep merged 5 commits into
mainfrom
any-file
Nov 25, 2026
Merged

nerdstep merged 5 commits into
mainfrom
any-file

Conversation

@nerdstep

@nerdstep nerdstep commented Nov 25, 2026 •

Copy link
Copy Markdown
Owner

Summary

You can now send any file, not just pictures. Files from disk go by path, so a big one is never read into the webview. Before that, the file store became one module.

 src-tauri/src/
+├── files.rs   # FileStore: <hash>/<name> and .part, intact / lost, resume + hash check,
+│              #   keep-while-referenced, prune, copy_in (hash while copying), may_open, may_show
 ├── chat.rs    # the transfer over streams; send_file (bytes) and send_file_from (path)
 └── lib.rs     # staging: pick_files, stage_paths, send_staged, staged_picture, unstage
paperclip → pick_files ─┐
drop (Tauri, paths) ────┴→ Staging (id → path, in Rust) → StagedFile {id, name, size, mime}
  picture ≤ 50 MB: preview from staged_picture(id), raw bytes over IPC (staged pictures only)
send → send_staged(id) → Core::send_file_from: copy_in (hash) → adopt → post
paste → bytes, as before, any file ≤ 100 MB

What opens: files::may_open is the one allow-list:

  • pictures
  • pdf, txt, md, csv
  • docx, xlsx, pptx, odt, ods, odp
  • common audio and video

Anything else can only be shown in its folder: programs, scripts, shortcuts, html, svg, Office files with macros, disk images and archives. Attachment.openable carries the answer, and the UI's copy of the list is gone.

Config: dragDropEnabled is now true. The CSP is unchanged: previews come over IPC, because a fetch from a custom URI scheme is cross-origin and the webview refuses it without CORS.

Where problems show: a problem with what's being sent (a refused file, a failed send or edit) shows in the hint above the message box. The top banner keeps everything else. Both share one card with a dismiss button.

There's no wire change. Peers on 0.7 already receive any file.

Evidence

  • The refactor changes no behaviour: the five protocol file tests pass unchanged.
  • New store unit tests, with a temp folder and an in-memory Db:
    • a file is here until it's edited on disk, then lost, forgotten and wanted again
    • resuming from a .part, and refusing too many bytes, too few, or a wrong hash
    • not keeping a file no message has, and pruning it once none does
    • a file the sender lost becoming gone
    • copying in: one copy kept, nothing half-copied left behind, an empty file refused, an interrupted copy removed at the next start
    • the type table, and may_open refusing 19 unsafe kinds, including trick.pdf.exe
  • New protocol test any_file_goes_from_disk_by_path: Alice sends Report.pdf from disk and then edits the original. Bob gets the original bytes, as application/pdf, with openable: true.
  • Checks: every commit passes bun run check, bun run test, bun run build, cargo fmt --check, clippy -D warnings and cargo test on its own.
  • Tried by hand on Windows: the picker, drag and drop, previews of dropped pictures, and the hint above the message box. Not yet tried on macOS.

Merge Danger

Door: two-way

There's no schema or wire change.

Blast Radius: files

The change touches sending and receiving every file, the drop overlay, and where errors show. There's no CSP change.

🤖 Generated with Claude Code

nerdstep and others added 5 commits November 25, 2026 12:21
files::FileStore owns the folder (`<hash>/<name>`, `<hash>.part` while
one arrives) and its rules: whether a file is intact, resuming, the hash
check, keeping only what a message has, and pruning. Work that touches
the database takes &Db; work that waits on the disk takes none, so Core
never holds the lock across an await. Core keeps the transfer and what
follows it (telling the UI, waking the fetcher).

No change in behaviour: the protocol file tests pass as they were, and
the store has unit tests of its own.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The paperclip opens the system's file picker, and files dropped on the
window come with their paths (Tauri's drag and drop): either way Rust
stages them and they go by path, never read into the webview, so a big
one isn't held in memory. The store copies a sent file in while hashing
it, so changing or moving the original afterwards makes no difference.

A staged picture's preview is made from tbstaged://, which serves only
staged pictures up to 50 MB. Pasting still goes as bytes, now for any
file up to 100 MB. Folders, empty files and anything over 1 GB are
turned away with a note.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
files::may_open is the one allow-list of what may open in its default
app: pictures, PDFs, text, Office and OpenDocument files without macros,
audio and video. Anything else (programs, scripts, shortcuts, web pages,
SVG, macro-enabled Office files, disk images, archives) can only be
shown in its folder. Attachment carries the answer as `openable`, so the
Open button and open_file can't disagree; the UI's copy of the list is
gone.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
README describes sending any file and what opens; its layout lists
files.rs. ROADMAP checks off "Any file" and adds "Remove from this
computer": freeing a received file's space on one side, on request.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A file that can't be sent, a paste that's too big, or a send or edit that fails now
shows in the hint above the message box, next to what it's about. The banner at the
top of the window keeps everything else, and both share one card with a dismiss button.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@nerdstep
nerdstep merged commit 05287dd into main Nov 25, 2026
3 checks passed
@nerdstep
nerdstep deleted the any-file branch November 25, 2026 22:22
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