mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-08-23 06:35:24 -07:00
fix: unintended modification to normalizedBaseUrl
This commit is contained in:
parent
ada90b518c
commit
e2cdcb2691
1 changed files with 5 additions and 5 deletions
|
@ -630,7 +630,7 @@ namespace
|
||||||
const QRegularExpression rx {uR"(((<a\s+[^>]*?href|<img\s+[^>]*?src)\s*=\s*["'])((https?|ftp):)?(\/\/[^\/]*)?(\/?[^\/"].*?)(["']))"_s
|
const QRegularExpression rx {uR"(((<a\s+[^>]*?href|<img\s+[^>]*?src)\s*=\s*["'])((https?|ftp):)?(\/\/[^\/]*)?(\/?[^\/"].*?)(["']))"_s
|
||||||
, QRegularExpression::CaseInsensitiveOption};
|
, QRegularExpression::CaseInsensitiveOption};
|
||||||
|
|
||||||
QString normalizedBaseUrl = baseUrl.endsWith(u'/') ? baseUrl : baseUrl + u'/';
|
const QString normalizedBaseUrl = baseUrl.endsWith(u'/') ? baseUrl : baseUrl + u'/';
|
||||||
const QUrl url {normalizedBaseUrl};
|
const QUrl url {normalizedBaseUrl};
|
||||||
const QString defaultScheme = url.scheme();
|
const QString defaultScheme = url.scheme();
|
||||||
QRegularExpressionMatchIterator iter = rx.globalMatch(html);
|
QRegularExpressionMatchIterator iter = rx.globalMatch(html);
|
||||||
|
@ -653,14 +653,14 @@ namespace
|
||||||
if (relativePath.startsWith(u'/'))
|
if (relativePath.startsWith(u'/'))
|
||||||
relativePath = relativePath.mid(1);
|
relativePath = relativePath.mid(1);
|
||||||
|
|
||||||
|
QString absoluteUrl;
|
||||||
if (!host.isEmpty())
|
if (!host.isEmpty())
|
||||||
{
|
absoluteUrl = defaultScheme + u":" + host;
|
||||||
normalizedBaseUrl = defaultScheme + u":" + host;
|
else
|
||||||
}
|
absoluteUrl = normalizedBaseUrl + relativePath;
|
||||||
const QString fullMatch = match.captured(0);
|
const QString fullMatch = match.captured(0);
|
||||||
const QString prefix = match.captured(1);
|
const QString prefix = match.captured(1);
|
||||||
const QString suffix = match.captured(7);
|
const QString suffix = match.captured(7);
|
||||||
const QString absoluteUrl = normalizedBaseUrl + relativePath;
|
|
||||||
|
|
||||||
html.replace(fullMatch, (prefix + absoluteUrl + suffix));
|
html.replace(fullMatch, (prefix + absoluteUrl + suffix));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue