Skip to content

Commit

Permalink
fix(ReportUser::checkUserIsReported): Always failed with Qt6
Browse files Browse the repository at this point in the history
QRegularExpression has a different behavior,
here it would only match the single line where the user was reported,
even though the pattern is .*$username.*

Add the option for DotMatchesEverything, which will match all lines
  • Loading branch information
tux3 authored and benapetr committed Jan 19, 2025
1 parent 4eb0678 commit 1f9df00
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/huggle_ui/reportuser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -599,11 +599,12 @@ bool ReportUser::checkUserIsReported()
{
QString regex = this->reportedUser->GetSite()->GetProjectConfig()->ReportUserCheckPattern;
regex.replace("$username", HREGEX_TYPE::escape(this->reportedUser->Username));
HREGEX_TYPE pattern(regex);
#ifdef QT6_BUILD
HREGEX_TYPE pattern(regex, QRegularExpression::DotMatchesEverythingOption);
QRegularExpressionMatch match = pattern.match(this->reportContent);
return match.hasMatch() && (match.captured(0) == this->reportContent);
#else
HREGEX_TYPE pattern(regex);
return pattern.exactMatch(this->reportContent);
#endif
}
Expand Down

0 comments on commit 1f9df00

Please sign in to comment.