Skip to content

Commit

Permalink
Fix pattern matching to accept "."
Browse files Browse the repository at this point in the history
  • Loading branch information
CrisBarreiro committed Dec 16, 2024
1 parent 31e55d3 commit 3f18b3e
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ class RealMaliciousSiteProtection @Inject constructor(
return IsMaliciousResult.SAFE
}
maliciousSiteRepository.getFilter(hash)?.let {
if (Pattern.matches(it.regex, url.toString())) {
if (Pattern.compile(it.regex).matcher(url.toString()).find()) {
Timber.d("\uD83D\uDFE2 Cris: shouldBlock $url")
return IsMaliciousResult.MALICIOUS
}
Expand All @@ -107,7 +107,7 @@ class RealMaliciousSiteProtection @Inject constructor(
): Boolean {
val matches = maliciousSiteRepository.matches(hashPrefix)
return matches.any { match ->
Pattern.matches(match.regex, url.toString()) &&
Pattern.compile(match.regex).matcher(url.toString()).find() &&
(hostname == match.hostname) &&
(hash == match.hash)
}.also { matched ->
Expand Down

0 comments on commit 3f18b3e

Please sign in to comment.