fix(desktop): remote-mode chat file links download via the fs bridge instead of dead file:// URLs - #44538
Closed
AIalliAI wants to merge 1 commit into
Closed
Conversation
Contributor
Author
|
Requesting maintainer review — this is ready to land from my side. Standalone fork CI is pending first-run approval here; the rollup branch in #44061 carrying this session's batch is fully green on upstream CI (all test shards, typecheck, e2e). |
AIalliAI
force-pushed
the
fix/44523-remote-media-dead-links
branch
from
June 14, 2026 17:44
a8cd040 to
3b2f2b4
Compare
23 tasks
Contributor
Author
|
@OutThisLife mind reviewing? In remote mode this routes chat file links through the fs bridge instead of the dead file:// URLs that currently fail to open. |
…idge instead of dead file:// URLs In remote-gateway mode, MediaAttachment's fallback anchor (and the audio/video Open-file button) opened file://<gateway path> — a path that only exists on the gateway machine, so the click silently did nothing. This hit both images outside the /api/media roots (403) and every non-image file such as PDFs (415, image-only allowlist), leaving no way to get those files client-side at all. Route the remote-mode fallback through the existing authenticated GET /api/fs/read-data-url endpoint (the same one the remote file browser preview uses) and hand the bytes to the user as a download, honoring the endpoint's size cap. When the gateway refuses the read, render an explicit failure note instead of a silent no-op. Local mode keeps the file:// open-with-OS behavior. Fixes NousResearch#44523
AIalliAI
force-pushed
the
fix/44523-remote-media-dead-links
branch
from
June 20, 2026 04:49
3b2f2b4 to
6b243ad
Compare
19 tasks
Contributor
|
Thanks for the focused remote-mode fix. This is already implemented on current
|
1 task
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.
Fixes #44523
Problem
In remote-gateway mode, the chat's file-link fallback (
MediaAttachment's final branch inapps/desktop/src/components/assistant-ui/markdown-text.tsx) renders an anchor whose click handler opensmediaExternalUrl(path)— afile://URL built from the gateway's absolute path. On the client machine that path doesn't exist, so the click silently does nothing.Two inputs funnel into this dead end:
/api/mediaroots — the endpoint 403s (intentionally; the fence is unchanged here), inline render fails, and the fallback anchor is the only affordance left./api/mediais image-extension-allowlisted (415), so there is no remote display path for them at all.The audio/video
OpenMediaButtonshown when playback fails had the same deadfile://handler.Fix
In remote mode, route the fallback through the existing authenticated
GET /api/fs/read-data-urlendpoint (added with the remote file browser in #44326 — the Files-panel preview already reads these same files over it), and hand the bytes to the user as a browser download (same fetch→blob→anchor pattern aszoomable-image.tsx/session-export.ts). The endpoint's existing size cap is honored: when the gateway refuses the read (413/403/404), the UI now shows an explicit "couldn't fetch from the gateway" note instead of silently no-opping.Local mode is unchanged —
file://URLs are correct there and open with the OS default app.The
/api/mediaroots fence is not widened (per the issue: that behavior is deliberate, and #42778 tracks configurability). No server-side changes at all.Changes
apps/desktop/src/lib/media.ts: newdownloadGatewayMediaFile()— fetches viareadDesktopFileDataUrl(the/api/fs/read-data-urlfacade) and triggers a client-side download.apps/desktop/src/components/assistant-ui/markdown-text.tsx: shareduseOpenMediaFilehook branches remote→download / local→file://; used by both the fallback anchor andOpenMediaButton; renders a failure note when the fetch fails.apps/desktop/src/lib/media.test.ts: new unit tests (download path,file://prefix stripping, gateway-refusal and empty-response rejection).Testing
npx vitest run --environment jsdom src/lib/media.test.ts src/lib/desktop-fs.test.ts src/components/assistant-ui/markdown-text.test.ts— 23/23 pass.tsc -p . --noEmitandeslinton changed files — clean.mainin this environment — pre-existing, unrelated.