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

This commit is contained in:
Patrick Honkonen 2025-10-09 13:58:24 -04:00 committed by GitHub
parent 81fa635430
commit 2d2b740ae1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 3 additions and 1 deletions

View File

@ -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)
}

View File

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