fix(Chat Filter): also lowercase incoming text (#3225)

This commit is contained in:
sch-lda 2024-06-05 21:51:35 +08:00 committed by GitHub
parent 6110db55fc
commit 2dbb931dea

View File

@ -143,7 +143,9 @@ namespace big::chat
{ {
std::string e_str(e); std::string e_str(e);
std::transform(e_str.begin(), e_str.end(), e_str.begin(), ::tolower); std::transform(e_str.begin(), e_str.end(), e_str.begin(), ::tolower);
if (strstr(text, e_str.c_str()) != 0) std::string text_str(text);
std::transform(text_str.begin(), text_str.end(), text_str.begin(), ::tolower);
if (strstr(text_str.c_str(), e_str.c_str()) != 0)
return SpamReason::STATIC_DETECTION; return SpamReason::STATIC_DETECTION;
} }
return SpamReason::NOT_A_SPAMMER; return SpamReason::NOT_A_SPAMMER;