fix(desktop): make file:// chat links clickable - #39206
Open
tauseefkhan-max wants to merge 1 commit into
Open
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). Fixes anomalyco#37891
Contributor
|
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. |
Contributor
|
Thanks for updating your PR! It now meets our contributing guidelines. 👍 |
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.
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