[Navigation] Fix deeplink domain parsing being case sensitive by bentrengrove · Pull Request #144 · androidx/androidx · GitHub | Latest TMZ Celebrity News & Gossip | Watch TMZ Live
Skip to content

[Navigation] Fix deeplink domain parsing being case sensitive #144

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

bentrengrove
Copy link
Contributor

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 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.

Testing

  • 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

Issues Fixed

https://issuetracker.google.com/issues/153829033
Fixes: b/153829033

@google-cla google-cla bot added the cla: yes label Mar 17, 2021
@dlam dlam requested a review from jbw0033 March 17, 2021 22:43
@@ -422,7 +422,7 @@ public class NavDeepLink internal constructor(
// specifically escape any .* instances to ensure
// 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)
Copy link

Choose a reason for hiding this comment

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

@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.

@jbw0033 jbw0033 requested a review from ianhanniballake March 29, 2021 20:21
@ianhanniballake
Copy link
Member

Thanks for fixing this!

@bentrengrove bentrengrove deleted the deeplink_case_sensitive branch March 29, 2021 22:07
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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants

TMZ Celebrity News – Breaking Stories, Videos & Gossip

Looking for the latest TMZ celebrity news? You've come to the right place. From shocking Hollywood scandals to exclusive videos, TMZ delivers it all in real time.

Whether it’s a red carpet slip-up, a viral paparazzi moment, or a legal drama involving your favorite stars, TMZ news is always first to break the story. Stay in the loop with daily updates, insider tips, and jaw-dropping photos.

🎥 Watch TMZ Live

TMZ Live brings you daily celebrity news and interviews straight from the TMZ newsroom. Don’t miss a beat—watch now and see what’s trending in Hollywood.