do not fetch some resources when they are not enabled

This commit is contained in:
Martin Rotter 2022-04-28 10:38:37 +02:00
parent 5e2cfbd778
commit 871c92c1b6
1 changed files with 23 additions and 18 deletions

View File

@ -433,6 +433,7 @@ void TextBrowserViewer::onAnchorClicked(const QUrl& url) {
void TextBrowserViewer::setHtml(const QString& html, const QUrl& base_url) {
setVerticalScrollBarPosition(0.0);
if (m_resourcesEnabled) {
static QRegularExpression img_tag_rgx("\\<img[^\\>]*src\\s*=\\s*[\"\']([^\"\']*)[\"\'][^\\>]*\\>",
QRegularExpression::PatternOption::CaseInsensitiveOption |
QRegularExpression::PatternOption::InvertedGreedinessOption);
@ -455,6 +456,10 @@ void TextBrowserViewer::setHtml(const QString& html, const QUrl& base_url) {
.toStdList();
m_neededResources = FROM_STD_LIST(QList<QUrl>, really_needed_resources);
}
else {
m_neededResources = {};
}
setHtmlPrivate(html, base_url);