Skip to content

fix: reveal a local file's folder in the native path spelling; send a picked mobile document from an app-owned copy - #1697

Merged
jiangzhuqing000 merged 5 commits into
mainfrom
pr/dev-jiangzhuqing000
Nov 26, 2026
Merged

jiangzhuqing000 merged 5 commits into
mainfrom
pr/dev-jiangzhuqing000

Conversation

@jiangzhuqing000

Copy link
Copy Markdown
Collaborator

What this carries

Two independent fixes, both on dev-jiangzhuqing000:

1. "Show in folder" reveals nothing near the file (desktop)

explorer accepts / in most Windows path APIs but not in its /select,
target: handed C:/Users/me/pic.png it opens Documents (or Desktop) instead.
A model writes the link for a file it just saved exactly that way
([pic.png](<C:/Users/me/pic.png>)), so "show in folder" on a file that was
right where the link said it was revealed somewhere else entirely.

Reproduced against the real file, both spellings of the same present path:

argument result
/select,"C:\…\hai_shang_sheng_ming_yue.png" opens the folder, selects the file
/select,"C:/…/hai_shang_sheng_ming_yue.png" opens Desktop
/select,C:/…/hai_shang_sheng_ming_yue.png opens Desktop
C:/…/thread-… (folder fallback) opens Documents

select_argument and the missing-file folder fallback now build their target
from native_separators (Windows: / → \; elsewhere unchanged, where / is
the separator). The open path — the menu's other entry — was checked
separately and is unaffected: ShellExecute opens the same forward-slash file
correctly.

cargo test -p futureos --lib commands::files: 14 pass, including the new
windows_reveal_normalizes_forward_slashes. cargo fmt --check and
cargo clippy -p futureos --lib --all-targets -- -D warnings clean.

2. A picked document is sent from a copy the app owns (mobile)

fix(mobile): send a picked document from a copy the app owns — a document a
user picks no longer has to stay readable at its original location for the
whole upload; the app takes its own copy first.

Verification

  • Desktop: the file-reveal module tests above, plus the earlier
    quoting/fallback work this branch already carried.
  • Mobile: mobile/src/remote/__tests__/files.test.ts and
    ChatScreen.test.ts cover the copy path.
  • dev-jiangzhuqing000 was re-synced with origin/main before this PR head was
    frozen, so the head is not BEHIND.

Note

The desktop change only takes effect in a rebuilt app; an installed build
predating it keeps the old behaviour.

Windows accepts `/` in most path APIs, but `explorer` does not: handed
`/select,"C:/Users/me/pic.png"` it opens Documents (or Desktop) instead — the
same wrong-folder symptom as a path that no longer exists, from a file that is
right where the link says it is. That spelling is not exotic: it is how a model
writes the link for a file it just saved the POSIX way, so "show in folder" on
a perfectly present file revealed nowhere near it.

Verified against the real file both ways: the backslash spelling selects the
file, the forward-slash spelling lands on Documents. `select_argument` and the
missing-file folder fallback now build their target from the native spelling;
elsewhere `/` is the separator and nothing changes.
The system file picker answers with the provider's URI rather than a path
(`content://` on Android), and the whole upload then reads through that
provider. A provider may serve only a stream — no size, no random access —
and the transfer reads one chunk at a time through a seekable handle, so it
finds nothing left to send and stops with a stalled attachment. Images never
met this: the photo picker and the converter both hand back files the app
owns, which is why only documents failed.

A picked document is now copied into the app's cache while the reader is
still in the picker, and the message carries the copy. When the copy comes
back empty (a size-driven copy of a stream reports success having written
nothing) the whole document is read instead — the one read every provider
supports — and the copy's size, not the provider's claim, becomes the
message's size, so an announced size the bytes disagree with can no longer
arrive at the desktop as an incomplete upload.

The copy also moves the point of failure: a document nobody can read is
refused before the waiting message's "+" cancels that message for a re-send,
so the reader loses neither the file nor the message, and says which of the
two it was.
@jiangzhuqing000
jiangzhuqing000 enabled auto-merge (squash) November 26, 2026 01:10
@jiangzhuqing000
jiangzhuqing000 merged commit a11da79 into main Nov 26, 2026
10 checks passed
@jiangzhuqing000
jiangzhuqing000 deleted the pr/dev-jiangzhuqing000 branch November 26, 2026 01:27
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