Repository navigation
fix: reveal a local file's folder in the native path spelling; send a picked mobile document from an app-owned copy - #1697
Merged
Conversation
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.
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.
What this carries
Two independent fixes, both on
dev-jiangzhuqing000:1. "Show in folder" reveals nothing near the file (desktop)
exploreraccepts/in most Windows path APIs but not in its/select,target: handed
C:/Users/me/pic.pngit 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 wasright where the link said it was revealed somewhere else entirely.
Reproduced against the real file, both spellings of the same present path:
/select,"C:\…\hai_shang_sheng_ming_yue.png"/select,"C:/…/hai_shang_sheng_ming_yue.png"/select,C:/…/hai_shang_sheng_ming_yue.pngC:/…/thread-…(folder fallback)select_argumentand the missing-file folder fallback now build their targetfrom
native_separators(Windows:/→\; elsewhere unchanged, where/isthe separator). The
openpath — the menu's other entry — was checkedseparately and is unaffected: ShellExecute opens the same forward-slash file
correctly.
cargo test -p futureos --lib commands::files: 14 pass, including the newwindows_reveal_normalizes_forward_slashes.cargo fmt --checkandcargo clippy -p futureos --lib --all-targets -- -D warningsclean.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 auser picks no longer has to stay readable at its original location for the
whole upload; the app takes its own copy first.
Verification
quoting/fallback work this branch already carried.
mobile/src/remote/__tests__/files.test.tsandChatScreen.test.tscover the copy path.dev-jiangzhuqing000was re-synced withorigin/mainbefore this PR head wasfrozen, 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.