Skip to content

Commit 12a51d0

Browse files
Jeremy Woodsandroid-build-prod (mdb)
authored andcommitted
[GH] [Navigation] Fix deeplink domain parsing being case sensitive
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)
1 parent 23b759c commit 12a51d0

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

‎navigation/navigation-common/src/main/java/androidx/navigation/NavDeepLink.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ public final class NavDeepLink {
9898
// specifically escape any .* instances to ensure
9999
// they are still treated as wildcards in our final regex
100100
String finalRegex = uriRegex.toString().replace(".*", "\\E.*\\Q");
101-
mPattern = Pattern.compile(finalRegex);
101+
mPattern = Pattern.compile(finalRegex, Pattern.CASE_INSENSITIVE);
102102
}
103103

104104
if (mimeType != null) {

0 commit comments

Comments
 (0)