Handle https://aw.app/openurl?url= universal links so the embedded URL opens#3441
Open
jim-daf wants to merge 1 commit into
Open
Handle https://aw.app/openurl?url= universal links so the embedded URL opens#3441jim-daf wants to merge 1 commit into
jim-daf wants to merge 1 commit into
Conversation
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
There was a problem hiding this comment.
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 legacyopenURL?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="; |
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.
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.comwere caught by the App Links intent filter, but
DeepLinkService.parseIntentdid not know how to unwrap them. Reading the code:
awallet://, so theAW_PREFIXstrip was a no op.https://aw.app/, so it never matchedthe legacy
OPEN_URL_PREFIX = "openURL?q="marker (different case, differentparameter name).
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
awallet://we now also strip thehttps://aw.app/host partso the parser can look at the path and query in isolation.
openurl?url=in addition to the legacyopenURL?q=. Both aretreated the same way and feed into the existing
URL_REDIRECTflow.Why this is safe
The new
OPEN_URL_PREFIX_WEBconstant is only consulted after the same checksthe legacy prefix already runs through, and the value still has to pass
Utils.isValidUrlbefore it is forwarded. There is no new sink for arbitraryuser 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
IntentTestandUniversalLinkTestcases still pass locally.