v0.1.9 — actually route external links to OS browser - #2
Merged
Conversation
v0.1.8 shipped the host-based split logic but two bugs prevented shell:open from succeeding, so external links (SharePoint, Office.com, OneDrive, customer sites) opened in-window instead of in the system browser. Bug 1 — capability had no URL scope The shell:allow-open permission was listed as a bare string in capabilities/default.json. Tauri 2 reads that as "command allowed, scope = empty", so every shell:open invoke rejected with "url not allowed by scope" before reaching the OS handler. Attaching an explicit allow array (https://**, http://**, mailto:*) makes the scope match real-world destinations. Bug 2 — openExternal lied about success The wrapper used a synchronous try/catch around invoke(), which returns a Promise. The catch caught nothing; the function returned true even when the IPC asynchronously rejected. The safety-net fallback in the click handler never fired, leaving either a dead click or (on some WKWebView builds) a fallthrough that the WebView resolved as in-window navigation. Returning a real Promise lets the caller await the actual outcome and route to in-window navigation when shell:open genuinely fails. window.open() got the same fix. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
This PR fixes the Tauri desktop shell’s external-link routing so non-internal target="_blank" and window.open(...) navigations are actually handed off to the OS browser instead of remaining in the app window. It fits into the desktop wrapper by correcting the shell permission scope and the injected WebView link-handling logic introduced in v0.1.8.
Changes:
- Adds an explicit
shell:allow-openURL scope forhttps,http, andmailtodestinations in the default Tauri capability. - Changes the injected
openExternal()helper to return a real Promise and updates click /window.openhandling to wait for the actual shell-open result before falling back. - Bumps the app version to
0.1.9across Tauri, Cargo, lockfile, and package metadata.
Reviewed changes
Copilot reviewed 5 out of 6 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
src-tauri/tauri.conf.json |
Bumps the Tauri app version to 0.1.9. |
src-tauri/src/lib.rs |
Fixes injected external-link handling to use async shell:open result correctly. |
src-tauri/Cargo.toml |
Bumps the Rust package version to 0.1.9. |
src-tauri/Cargo.lock |
Updates the lockfile’s root package version entry. |
src-tauri/capabilities/default.json |
Adds the URL allow-scope required for shell:open to succeed. |
package.json |
Bumps the JS package version to 0.1.9. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
Summary
v0.1.8 shipped the host-based split logic for
target="_blank"clicks (internal hosts in-window, external hosts viashell:open) — but two bugs preventedshell:openfrom ever succeeding, so external links (SharePoint, Office.com, OneDrive, customer sites) kept opening inside the desktop window instead of in the system browser. v0.1.9 fixes the actual delivery.Bugs
1. Capability had no URL scope
shell:allow-openwas listed as a bare string incapabilities/default.json. Tauri 2 reads that as "command allowed, scope = empty", so everyshell:openinvoke was rejected with "url not allowed by scope" at the rust side before reaching the OS browser.Fix: attach an explicit
allowscope to the permission covering the actual destinations:{ "identifier": "shell:allow-open", "allow": [ { "url": "https://**" }, { "url": "http://**" }, { "url": "mailto:*" } ] }2.
openExternal()lied about successThe wrapper used a synchronous
try/catcharoundinvoke():But
invoke()returns a Promise. The synchronous catch caught nothing; the function returnedtrueeven when the IPC asynchronously rejected. The safety-net fallback in the click handler never fired — leaving either a dead click or (on some WKWebView builds) a fallthrough the WebView resolved as in-window navigation.Fix: return a real Promise from
openExternal, await it in the click handler, fall back towindow.location.hrefonly when the Promise resolves tofalse. Same fix applied to thewindow.openoverride.What's still v0.1.8 behavior
internal.automators.com,auth.automators.com) → in-window navigation.Test plan
/salesor/decks: click any SharePoint file card (Excel/Word/PowerPoint) → opens in default browser, NOT inside the app/sales→ customer detail) → still navigates in-windowRelease
Updater is configured in
tauri.conf.jsonto pull from GitHub Releaseslatest.json. Once the release is cut, existing v0.1.8 installs auto-download v0.1.9 in the background and use it on next quit/relaunch.🤖 Generated with Claude Code