Update src/Protocol/Relay.php

Co-authored-by: Hypolite Petovan <hypolite@mrpetovan.com>
This commit is contained in:
Michael Vogel 2024-01-27 00:13:14 +01:00 committed by GitHub
parent b8f80a8d25
commit 120044f3da
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -120,7 +120,7 @@ class Relay
$cleaned = preg_replace('/[@!#]\[url\=.*?\].*?\[\/url\]/ism', '', $body); $cleaned = preg_replace('/[@!#]\[url\=.*?\].*?\[\/url\]/ism', '', $body);
$content_cleaned = mb_strtolower(BBCode::toPlaintext($cleaned, false)); $content_cleaned = mb_strtolower(BBCode::toPlaintext($cleaned, false));
if (strlen($content_cleaned) < (strlen($content) - strlen($content_cleaned))) { if (strlen($content_cleaned) < strlen($content) / 2) {
Logger::info('Possible hashtag spam detected - rejected', ['hashtags' => $tags, 'network' => $network, 'url' => $url, 'causer' => $causer, 'body' => $body]); Logger::info('Possible hashtag spam detected - rejected', ['hashtags' => $tags, 'network' => $network, 'url' => $url, 'causer' => $causer, 'body' => $body]);
return false; return false;
} }