This commit is contained in:
Martin Rotter 2024-08-20 10:02:23 +02:00
parent 5788f89a07
commit 29d688c343
1 changed files with 3 additions and 2 deletions

View File

@ -418,9 +418,10 @@ void TextBrowserViewer::onAnchorClicked(const QUrl& url) {
void TextBrowserViewer::setHtml(const QString& html, const QUrl& base_url) {
if (m_resourcesEnabled) {
// NOTE: This regex is problematic as it does not work for ALL
// HTMLs, maybe use XML parsing to extract what we need?
static QRegularExpression img_tag_rgx("\\<img[^\\>]*src\\s*=\\s*[\"\']([^\"\']*)[\"\'][^\\>]*\\>",
QRegularExpression::PatternOption::CaseInsensitiveOption |
QRegularExpression::PatternOption::InvertedGreedinessOption);
QRegularExpression::PatternOption::CaseInsensitiveOption);
QRegularExpressionMatchIterator i = img_tag_rgx.globalMatch(html);
QList<QUrl> found_resources;