Skip to content

fix(desktop): open local file paths with file:// scheme#19146

Open
jecruz wants to merge 1 commit intoanomalyco:devfrom
jecruz:fix/desktop-open-local-file-paths
Open

fix(desktop): open local file paths with file:// scheme#19146
jecruz wants to merge 1 commit intoanomalyco:devfrom
jecruz:fix/desktop-open-local-file-paths

Conversation

@jecruz
Copy link

@jecruz jecruz commented Mar 25, 2026

Issue for this PR

Closes #19144

Type of change

  • Bug fix

What does this PR do?

When cmd+clicking on a local file path (e.g., README.md, src/app.ts) in a chat message, the open-link handler now converts bare paths to file:// URLs with resolved absolute paths before calling shell.openExternal().

Root cause: In packages/desktop-electron/src/main/ipc.ts, the open-link handler passed bare file paths directly to shell.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?

  • Tested clicking README.md in a chat message - opens in default markdown viewer (mkdn)
  • Tested clicking src/app.ts - opens in default text editor
  • Verified https:// URLs still open in browser
  • Verified file:// URLs still work correctly
  • Verified paths are resolved to absolute before opening

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

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
@github-actions github-actions bot added needs:compliance This means the issue will auto-close after 2 hours. and removed needs:compliance This means the issue will auto-close after 2 hours. labels Mar 25, 2026
@github-actions
Copy link
Contributor

Thanks for updating your PR! It now meets our contributing guidelines. 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Cmd+click on local file paths opens wrong URL (http instead of file://)

1 participant