Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Change regex pattern matching to case insensitive
  • Loading branch information
Ben Trengrove
Ben Trengrove committed Mar 17, 2021
commit 75f7756e6b6c2874f8b0b239cb3d9d8e865dd50e
Original file line number Diff line number Diff line change
Expand Up @@ -1076,7 +1076,7 @@ class NavDeepLinkTest {
.that(matchArgs?.containsKey("path"))
.isFalse()
}

@Test
fun deepLinkCaseSensitiveParams() {
Comment thread
bentrengrove marked this conversation as resolved.
Resolved
val deepLinkString = "$DEEP_LINK_EXACT_HTTP/?myParam={param}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Copy Markdown

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.

}
if (mimeType != null) {
val mimeTypePattern = Pattern.compile("^[\\s\\S]+/[\\s\\S]+$")
Expand Down