fix: fix external link opening in desktop#599
Conversation
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Tip Try Coding Plans. Let us write the prompt for your AI agent so you can ship faster (with fewer bugs). Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
59f95a4 to
015ee56
Compare
| if (parsedUrl.protocol !== "https:" && parsedUrl.protocol !== "http:") { | ||
| return null; | ||
| } |
There was a problem hiding this comment.
what about deep-linking into other apps etc?
There was a problem hiding this comment.
This project uses react-markdown, which has a default URL transform that wouldn't allow deep-linking into other apps: https://github.com/remarkjs/react-markdown?tab=readme-ov-file#defaulturltransformurl
It's probably a change worth making, but it is a larger change than I would like to PR in this project as-is (especially since they aren't really even accepting PR's in the first place)
|
A quick read suggests this might break opening code-file links in IDE, can you confirm those are fine? If so will merge |
@t3dotgg This PR works with Cursor links and external links. screen-recording-compressed.mp4vscode links (or other external apps) like |
|
Legend ty! |
What Changed
Added electron link handling for safe links so they open in an external browser.
I have validated that file links still open in Cursor, and that external links work in both the browser and desktop environment.
Why
Clicking on external links in the agent response was doing nothing rather than opening in an external browser.
Fixes #434
UI Changes
Checklist
Note
Validate and open http/https external links from desktop by routing
main.createWindowwindow-open requests andmain.registerIpcHandlersOPEN_EXTERNALthroughmain.getSafeExternalUrlin main.tsAdd
main.getSafeExternalUrlto normalize and guard URLs; updateOPEN_EXTERNALIPC handler andwebContents.setWindowOpenHandlerto use it and open validated links viashell.openExternalin main.ts.📍Where to Start
Start with
getSafeExternalUrland its use in theOPEN_EXTERNALIPC handler andwebContents.setWindowOpenHandlerin main.ts.Macroscope summarized 015ee56.