[Navigation] Fix deeplink domain parsing being case sensitive#144
Closed
bentrengrove wants to merge 5 commits intoandroidx:androidx-mainfrom
Closed
[Navigation] Fix deeplink domain parsing being case sensitive#144bentrengrove wants to merge 5 commits intoandroidx:androidx-mainfrom
bentrengrove wants to merge 5 commits intoandroidx:androidx-mainfrom
Conversation
jbw0033
requested changes
Mar 22, 2021
| // they are still treated as wildcards in our final regex | ||
| val finalRegex = uriRegex.toString().replace(".*", "\\E.*\\Q") | ||
| pattern = Pattern.compile(finalRegex) | ||
| pattern = Pattern.compile(finalRegex, Pattern.CASE_INSENSITIVE) |
There was a problem hiding this comment.
@ianhanniballake Since this is on the finalRegex, it is making the entire pattern including params case insensitive, but based on the test above, it looks like params still aren't matching, which is what we want. Wanted your thoughts on this method, vs always checking the domain in the lowercase or something similar.
added 2 commits
March 23, 2021 09:27
jbw0033
approved these changes
Mar 29, 2021
Member
|
Thanks for fixing this! |
BreezyHe
pushed a commit
to Tencent-TDS/ovCompose-multiplatform-core
that referenced
this pull request
Apr 27, 2025
The current regex pattern matcher was doing a case sensitive check of the domain and arguments. Simply changing it to case insensitive seems to be all that's required to fix this bug. It is important that parameters are still case sensitive but this is still the case as parameter matching is done by the `Uri` code not the `NavDeepLink` code. I have written tests to cover these cases. If it is deemed too risky to just run the pattern matcher with `CASE_INSENSITIVE` I believe the regex will have to be redesigned not to use `\Q\E`. - Tested using the sample project and deep linking via `adb shell am start -a android.intent.action.VIEW -d https://www.Iana.org/domains/second` - Added new unit tests to the project for the different case insensitive and sensitive sections Test: /gradlew test connectedCheck https://issuetracker.google.com/issues/153829033 Fixes: b/153829033 This is an imported pull request from androidx/androidx#144. Resolves #144 Github-Pr-Head-Sha: 868bcf3346af6eb46da7e5988977574be8843eba GitOrigin-RevId: 0c507315877618e865f6a79ce4e01ca594da28a9 Change-Id: I71d640222a3501c9a10e99a160a1a11e04c10d58 (cherry picked from commit 20b54b64d99d8c6caf0ec4a43e9444f7909cd5e2)
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.
Proposed Changes
The current regex pattern matcher was doing a case sensitive check of the domain and arguments. Simply changing it to case insensitive seems to be all that's required to fix this bug. It is important that parameters are still case sensitive but this is still the case as parameter matching is done by the
Uricode not theNavDeepLinkcode. I have written tests to cover these cases.If it is deemed too risky to just run the pattern matcher with
CASE_INSENSITIVEI believe the regex will have to be redesigned not to use\Q\E.Testing
adb shell am start -a android.intent.action.VIEW -d https://www.Iana.org/domains/secondTest: /gradlew test connectedCheck
Issues Fixed
https://issuetracker.google.com/issues/153829033
Fixes: b/153829033