[#5997] Allow underscores in Block Autofill URI patterns (#6000)

This commit is contained in:
Patrick Honkonen authored and GitHub committed 2025-10-09 17:58:24 +00:00
1 parent 81fa635430
commit 2d2b740ae1
2 files changed
+3 -1

No files matched your search

@@ -44,6 +44,6 @@ fun String.validateUri(existingUris: List<String>): Text? {
* Checks if the string matches a specific URI pattern.
*/
fun String.isValidPattern(): Boolean {
val pattern = "^(https?|androidapp)://([A-Za-z0-9-]+(?:\\.[A-Za-z0-9-]+)*)(/.*)?$".toRegex()
val pattern = "^(https?|androidapp)://([A-Za-z0-9_-]+(?:\\.[A-Za-z0-9_-]+)*)(/.*)?$".toRegex()
return matches(pattern)
}
@@ -54,7 +54,9 @@ class StringExtensionsTest {
"https://a",
"http://a.com",
"https://subdomain.example.com",
"https://example.com/path_with_underscores",
"androidapp://com.example.app",
"androidapp://com.example.app/path_with_underscores",
)
val invalidUris = listOf(