Open same-host non-HTTP(S) URLs (webcal:, mailto:, ...) via the system#255
Open
pardeyke wants to merge 1 commit into
Open
Open same-host non-HTTP(S) URLs (webcal:, mailto:, ...) via the system#255pardeyke wants to merge 1 commit into
pardeyke wants to merge 1 commit into
Conversation
AppNavigationRouteDecisionHandler matched on host alone, so a same-host URL with a custom scheme (e.g. webcal://my.app.com/calendar.ics) was routed as an in-app Turbo visit, which fails: Turbo.js cannot history.pushState() across protocols and the visit ends with error 0. Require an HTTP(S) scheme in AppNavigationRouteDecisionHandler and make SystemNavigationRouteDecisionHandler claim non-HTTP(S) URLs regardless of host, so the system opens them like it already does for sms: and mailto: links on other hosts. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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.
Same-host URLs with a non-HTTP(S) scheme are currently routed as in-app Turbo visits, which always fail. This PR routes them through
SystemNavigationRouteDecisionHandlerinstead, so the system opens them — matching how external-scheme links on other hosts already behave.The problem
A link like
webcal://my.app.com/calendars/subscribe.ics(calendar subscription served by the app's own backend) matchesAppNavigationRouteDecisionHandler, because it compares hosts without looking at the scheme. The resulting Turbo visit can't work — Turbo.js can't even record it in history:The visit then fails with status code 0 and falls into the JS fetch recovery path, which also fails (
unsupported URL), ending in an error screen.SystemNavigationRouteDecisionHandlerdoesn't catch this case either: it only matches when hosts differ. Its existing tests (test_sms_urls_match,test_non_http_urls_match) show the intent is for external schemes to be opened by the system — those URLs just happen to have anilhost, so they pass the host comparison by accident. As soon as the URL carries the app's own host, the intent breaks down.The fix
AppNavigationRouteDecisionHandleronly matcheshttp/httpsURLs — it can only ever route those in-app.SystemNavigationRouteDecisionHandlermatches any non-HTTP(S) URL regardless of host, soUIApplication.shared.openhands it to the owning app (Calendar forwebcal:, Mail formailto:, ...).Behavior for HTTP(S) URLs is unchanged, so this shouldn't affect
SafariViewControllerRouteDecisionHandleror the universal-link handling from #191 / #195. Tests added for the same-hostwebcal:case on both handlers; the full suite passes.🤖 Generated with Claude Code