Skip to content

Handle https://aw.app/openurl?url= universal links so the embedded URL opens#3441

Open
jim-daf wants to merge 1 commit into
AlphaWallet:masterfrom
jim-daf:fix/openurl-universal-link-2411
Open

Handle https://aw.app/openurl?url= universal links so the embedded URL opens#3441
jim-daf wants to merge 1 commit into
AlphaWallet:masterfrom
jim-daf:fix/openurl-universal-link-2411

Conversation

@jim-daf
Copy link
Copy Markdown

@jim-daf jim-daf commented Apr 22, 2026

Open universal links of the form https://aw.app/openurl?url=...

Resolves #2411

On Android, links such as https://aw.app/openurl?url=http%3A%2F%2Fexample.com
were caught by the App Links intent filter, but DeepLinkService.parseIntent
did not know how to unwrap them. Reading the code:

  1. The link did not start with awallet://, so the AW_PREFIX strip was a no op.
  2. The remaining string still started with https://aw.app/, so it never matched
    the legacy OPEN_URL_PREFIX = "openURL?q=" marker (different case, different
    parameter name).
  3. The fall through path treated the whole thing as a magic link and bailed out.

The result is the screen the reporter shared, where AlphaWallet opens to the
home tab and the embedded URL is silently dropped. iOS works because its
Universal Link path uses a different code path.

What changed

  1. After stripping awallet:// we now also strip the https://aw.app/ host part
    so the parser can look at the path and query in isolation.
  2. We accept openurl?url= in addition to the legacy openURL?q=. Both are
    treated the same way and feed into the existing URL_REDIRECT flow.

Why this is safe

The new OPEN_URL_PREFIX_WEB constant is only consulted after the same checks
the legacy prefix already runs through, and the value still has to pass
Utils.isValidUrl before it is forwarded. There is no new sink for arbitrary
user input.

Testing

Reproduced the bug on a Pixel 6 emulator with the link from the issue. With the
patch the in app browser opens the embedded URL. Existing IntentTest and
UniversalLinkTest cases still pass locally.

The DeepLinkService only recognised the legacy lower case marker openURL?q=
which is what awallet:// custom scheme links use. Universal links coming
from the web (https://aw.app/openurl?url=...) were not unwrapped, so the
embedded URL never reached the in app browser.

Strip the AW_APP host prefix when present and accept the openurl?url=
variant in addition to openURL?q=.

Fixes AlphaWallet#2411
@jim-daf jim-daf marked this pull request as ready for review April 22, 2026 19:15
@jim-daf jim-daf requested a review from JamesSmartCell as a code owner April 22, 2026 19:16
Copilot AI review requested due to automatic review settings April 22, 2026 19:16
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates Android deep link parsing to better handle universal links that wrap another URL (e.g. https://aw.app/openurl?url=...) so the embedded URL can be opened via the existing URL_REDIRECT flow.

Changes:

  • Add support for the openurl?url= variant alongside legacy openURL?q=.
  • Strip the https://aw.app/ prefix before checking for open-url markers.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +44 to +48
// Universal links arrive as https://aw.app/openurl?url=... so strip the
// host part too before we look for the openURL marker.
if (importData.startsWith(AW_APP))
{
importData = importData.substring(AW_APP.length());
public static final String AW_PREFIX = "awallet://";
public static final String OPEN_URL_PREFIX = "openURL?q=";
// Lower case variant produced by web pages that link to https://aw.app/openurl?url=...
public static final String OPEN_URL_PREFIX_WEB = "openurl?url=";
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.

Universal link with embedded URL doesn't work

2 participants