From e2cdcb269133a6eb3cd6ab2cf90147fcd863cbdf Mon Sep 17 00:00:00 2001 From: Zentino Date: Mon, 16 Dec 2024 23:46:23 +0800 Subject: [PATCH] fix: unintended modification to `normalizedBaseUrl` --- src/gui/rss/rsswidget.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/gui/rss/rsswidget.cpp b/src/gui/rss/rsswidget.cpp index 7bf6eeb1f..14d558d44 100644 --- a/src/gui/rss/rsswidget.cpp +++ b/src/gui/rss/rsswidget.cpp @@ -630,7 +630,7 @@ namespace const QRegularExpression rx {uR"(((]*?href|]*?src)\s*=\s*["'])((https?|ftp):)?(\/\/[^\/]*)?(\/?[^\/"].*?)(["']))"_s , QRegularExpression::CaseInsensitiveOption}; - QString normalizedBaseUrl = baseUrl.endsWith(u'/') ? baseUrl : baseUrl + u'/'; + const QString normalizedBaseUrl = baseUrl.endsWith(u'/') ? baseUrl : baseUrl + u'/'; const QUrl url {normalizedBaseUrl}; const QString defaultScheme = url.scheme(); QRegularExpressionMatchIterator iter = rx.globalMatch(html); @@ -653,14 +653,14 @@ namespace if (relativePath.startsWith(u'/')) relativePath = relativePath.mid(1); + QString absoluteUrl; if (!host.isEmpty()) - { - normalizedBaseUrl = defaultScheme + u":" + host; - } + absoluteUrl = defaultScheme + u":" + host; + else + absoluteUrl = normalizedBaseUrl + relativePath; const QString fullMatch = match.captured(0); const QString prefix = match.captured(1); const QString suffix = match.captured(7); - const QString absoluteUrl = normalizedBaseUrl + relativePath; html.replace(fullMatch, (prefix + absoluteUrl + suffix)); }