mirror of
https://github.com/d47081/qBittorrent.git
synced 2025-01-11 15:27:54 +00:00
Correctly detect trackers with invalid TLDs or IPv4/IPv6 addresses.
This commit is contained in:
parent
e378f28fb7
commit
6c579950f6
@ -718,6 +718,10 @@ QString TrackerFiltersList::getHost(const QString &trakcer) const
|
|||||||
QUrl url(trakcer);
|
QUrl url(trakcer);
|
||||||
QString longHost = url.host();
|
QString longHost = url.host();
|
||||||
QString tld = url.topLevelDomain();
|
QString tld = url.topLevelDomain();
|
||||||
|
// We get empty tld when it is invalid or an IPv4/IPv6 address,
|
||||||
|
// so just return the full host
|
||||||
|
if (tld.isEmpty())
|
||||||
|
return longHost;
|
||||||
// We want the domain + tld. Subdomains should be disregarded
|
// We want the domain + tld. Subdomains should be disregarded
|
||||||
int index = longHost.lastIndexOf('.', -(tld.size() + 1));
|
int index = longHost.lastIndexOf('.', -(tld.size() + 1));
|
||||||
if (index == -1)
|
if (index == -1)
|
||||||
|
Loading…
Reference in New Issue
Block a user