Browse Source

Correctly detect trackers with invalid TLDs or IPv4/IPv6 addresses.

adaptive-webui-19844
sledgehammer999 10 years ago
parent
commit
6c579950f6
  1. 4
      src/gui/transferlistfilterswidget.cpp

4
src/gui/transferlistfilterswidget.cpp

@ -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…
Cancel
Save