fix: try fixing X deeplinks by adding $deeplink_path param [GE-139] cp-7.69.0#27139
Conversation
|
CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes. |
|
This fixes #27140 |
ef3350a to
bc6ef9d
Compare
| ): string | undefined { | ||
| if (!uri || !params?.['+clicked_branch_link']) return uri; | ||
| const rawPath = params.$deeplink_path; | ||
| if (typeof rawPath !== 'string') return uri; |
There was a problem hiding this comment.
Cold start incorrectly processes unrewritten ~referring_link URI
High Severity
rewriteBranchUri returns the original uri (truthy) when rewriting conditions aren't met (e.g., +clicked_branch_link is false or $deeplink_path is absent). The cold start caller checks if (rewritten) as a gate, so any truthy ~referring_link bypasses the +non_branch_link fallback. This causes the app to process a raw, unresolvable Branch short link (leading to a 404) or a stale ~referring_link from a prior session. The function needs to return undefined instead of uri when it doesn't actually rewrite.
Additional Locations (1)
Cal-L
left a comment
There was a problem hiding this comment.
Code looks good. Let's revert the version changes
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
d85ee5b to
de4e3dc
Compare
🔍 Smart E2E Test Selection
click to see 🤖 AI reasoning detailsE2E Test Selection: Key impacts:
These changes can directly affect:
No changes affect controllers, Engine, account management, network management, Snaps, or multi-chain provider logic. Therefore, broader tags like SmokeWalletPlatform, SmokeAccounts, SmokeNetworkAbstractions, etc., are not required. Given the centrality of deep links to growth and transaction flows, this is medium risk: incorrect rewriting could silently break swap or buy entry points. Running the focused trade + confirmations + ramps suites provides strong coverage with minimal over-testing. Performance Test Selection: |
|
✅ E2E Fixture Validation — Schema is up to date |
|





Description
Fix branch deeplinks not working with the X (Twitter) app by adding a
$deeplink_pathparam in branch.io and consuming it in MetaMask Mobile.Context
What we found
Changelog
CHANGELOG entry: Fixed a bug that was causing deeplinks opened from X app to fail
Related issues
Fixes: https://consensyssoftware.atlassian.net/browse/GE-139
Fixes: #27140
Manual testing steps
Screenshots/Recordings
Before
After
Pre-merge author checklist
Pre-merge reviewer checklist
Note
Medium Risk
Touches deeplink routing/host allowlists and Branch handling on app start, which can affect navigation from external links, but the change is narrowly scoped and covered by new unit tests.
Overview
Fixes Branch short-link universal links (notably from X on iOS) by introducing
rewriteBranchUri, which convertsmetamask-alternate.app.link/<id>URLs intohttps://link.metamask.io/<$deeplink_path>while preserving query params.DeeplinkManager.start()now applies this rewrite for both cold-start Branch params (~referring_link) andbranch.subscribeevents, replacing the priorgetLatestReferringParamsfallback logic.Adds
MM_UNIVERSAL_LINK_HOST_ALTERNATE(metamask-alternate.app.link) and includes it in universal-link host validation (handleUniversalLink) and MetaMask-host detection (util/deeplinks), with new tests covering rewrite and routing behavior.Written by Cursor Bugbot for commit de4e3dc. This will update automatically on new commits. Configure here.