Commit 3503b75e authored by Laurent Montel's avatar Laurent Montel 😁

Remove script from mail directly

(cherry picked from commit 111feeb5)
parent 222f6732
......@@ -24,6 +24,7 @@
#include <cassert>
#include <QByteArray>
#include <QRegularExpression>
using namespace MessageViewer;
......@@ -60,6 +61,7 @@ void WebEnginePartHtmlWriter::end()
insertExtraHead();
mExtraHead.clear();
}
removeJscripts();
mHtmlView->setHtml(mHtml, QUrl(QStringLiteral("file:///")));
mHtmlView->show();
mHtml.clear();
......@@ -70,6 +72,12 @@ void WebEnginePartHtmlWriter::end()
Q_EMIT finished();
}
void WebEnginePartHtmlWriter::removeJscripts()
{
const QRegularExpression reg(QStringLiteral("<script>.*</script>"));
mHtml.remove(reg);
}
void WebEnginePartHtmlWriter::reset()
{
if (mState != Ended) {
......
......@@ -54,6 +54,7 @@ private:
void insertExtraHead();
private:
void removeJscripts();
MailWebEngineView *mHtmlView;
QString mHtml;
QString mExtraHead;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment