Skip to content

Commit 0bc0faf

Browse files
committed
Fixed anti-spam handler when message contains only emoji
1 parent f8c7699 commit 0bc0faf

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

app/Services/SpamDetector.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,11 @@ public function hasExcessiveUnicodeCharacters(float $threshold = 0.02): bool
8585
->replaceMatches('/[^\p{L}\p{N}\p{Z}\p{P}]/u', '')
8686
->length();
8787

88+
// Message contains only emoji
89+
if ($withOutUnicode < 1) {
90+
return false;
91+
}
92+
8893
// Difference in length
8994
$unicodeLength = $withUnicode - $withOutUnicode;
9095

0 commit comments

Comments
 (0)