Skip to content

Commit

Permalink
fix strip_html img tag handling
Browse files Browse the repository at this point in the history
  • Loading branch information
tsteven4 committed Sep 15, 2024
1 parent 40fe2ef commit b0440f7
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion util.cc
Original file line number Diff line number Diff line change
Expand Up @@ -785,6 +785,8 @@ QString strip_html(const QString& utfstring)
assert(trre.isValid());
static const QRegularExpression tdre("<td.*?>", QRegularExpression::CaseInsensitiveOption | QRegularExpression::DotMatchesEverythingOption);
assert(tdre.isValid());
static const QRegularExpression imgre("<img.*?>", QRegularExpression::CaseInsensitiveOption | QRegularExpression::DotMatchesEverythingOption);
assert(imgre.isValid());
static const QRegularExpression otherre("<.*?>", QRegularExpression::CaseInsensitiveOption | QRegularExpression::DotMatchesEverythingOption);
assert(otherre.isValid());

Expand All @@ -796,7 +798,7 @@ QString strip_html(const QString& utfstring)
out.replace(brre, "\n");
out.replace(trre, "\n");
out.replace(tdre, " ");
out.replace("<img", "[IMG]", Qt::CaseInsensitive);
out.replace(imgre, "[IMG]");
out.replace(otherre, "");

// Then entity replacement (entities are case sensitive)
Expand Down

0 comments on commit b0440f7

Please sign in to comment.