mirror of
https://github.com/bitwarden/android.git
synced 2025-12-10 00:06:22 -06:00
parent
81fa635430
commit
2d2b740ae1
@ -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(
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user