fix(desktop): open local file paths with file:// scheme#19146
Open
jecruz wants to merge 1 commit intoanomalyco:devfrom
Open
fix(desktop): open local file paths with file:// scheme#19146jecruz wants to merge 1 commit intoanomalyco:devfrom
jecruz wants to merge 1 commit intoanomalyco:devfrom
Conversation
When cmd+clicking on a local file path (README.md, src/app.ts, etc.), the open-link handler now converts bare paths to file:// URLs with resolved absolute paths before calling shell.openExternal(). Fixes anomalyco#19144
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 #19144
Type of change
What does this PR do?
When cmd+clicking on a local file path (e.g.,
README.md,src/app.ts) in a chat message, theopen-linkhandler now converts bare paths tofile://URLs with resolved absolute paths before callingshell.openExternal().Root cause: In
packages/desktop-electron/src/main/ipc.ts, theopen-linkhandler passed bare file paths directly toshell.openExternal(), which treated them as HTTP URLs and failed with "Unable to connect" error.Fix: Check if the URL has a scheme. If not, treat it as a local file path, resolve to absolute path, and prepend
file://.How did you verify your code works?
README.mdin a chat message - opens in default markdown viewer (mkdn)src/app.ts- opens in default text editorhttps://URLs still open in browserfile://URLs still work correctlyChecklist