Uh oh!
There was an error while loading. Please reload this page.
fix(desktop): make file:// chat links clickable - #39206
Conversation
DOMPurify was stripping file: hrefs, and the desktop click handler always routed through openExternal. Keep file: links on desktop, open them via the existing openPath/revealPath IPC (http(s) still go through openLink, hardened to http(s)-only). Fixesanomalyco#37891
The following comment was made by an LLM, it may be inaccurate: Related PRs Found:
These are complementary improvements rather than duplicates—one covers TUI file path clickability while the other validates URL protocols on desktop. |
Thanks for updating your PR! It now meets our contributing guidelines. 👍 |
100kristine
commented
Aug 6, 2026
this would be amazing, hope it can ship soon! one of the biggest problems with the desktop app rn |
wulinsekai
commented
Aug 13, 2026
+1 for this — exactly the gap we're hitting on a daily basis. Our agents produce a lot of Two quick notes:
Happy to test the desktop build once it's merged. |
Automated PR Cleanup Thank you for contributing to opencode. Due to the high volume of PRs from users and AI agents, we periodically close older PRs using automated criteria so maintainers can focus review time on the most active and community-supported contributions. This PR was closed because it matched the following cleanup criteria:
PRs created within the last month are not affected by this cleanup. If you believe this PR was closed incorrectly, or if you are still actively working on it, please leave a comment explaining why it should be reopened. A maintainer can review and reopen it if appropriate. Thanks again for taking the time to contribute. |
Issue for this PR
Closes#37891
Type of change
What does this PR do?
In the desktop app,
file://links and absolute paths in chat looked clickable but did nothing.Two causes:
file:hrefs (default URI allowlist is web-only).shell.openExternalviaopen-link, which is the wrong path for local files (and fix(desktop): restrict external links #38914 is tightening that further to http(s)-only).This PR:
file:through the sanitizer only on desktop (oc://renderer / desktop API present). Web is unchanged.file://and absolute-path hrefs go through existingopenPath/revealPathIPC (already used by the session header). Modifier-click (⌘/Ctrl/Alt) reveals in Finder/Explorer; plain click opens with the OS default app.open-linkto http(s) only so local paths never hitopenExternal.file://links on desktop.Workspace-relative path chips and opening in the built-in editor tab are out of scope here.
How did you verify your code works?
All 15 tests pass. Unit coverage includes URI parsing (unix/windows/
file:/line:col suffixes),safeExternalUrlrejection of non-http(s), and desktop path→href conversion.Screenshots / recordings
N/A — behavior change on click; no visual layout change beyond links remaining present after sanitize (they were stripped before).
Checklist