diff --git a/src/gui/transferlistfilterswidget.cpp b/src/gui/transferlistfilterswidget.cpp index 8bfefe9ed..448217cfa 100644 --- a/src/gui/transferlistfilterswidget.cpp +++ b/src/gui/transferlistfilterswidget.cpp @@ -70,11 +70,14 @@ namespace return !scheme.isEmpty() ? scheme : u"http"_qs; } - QString getHost(const QString &tracker) + QString getHost(const QString &url) { // We want the domain + tld. Subdomains should be disregarded - const QUrl url {tracker}; - const QString host {url.host()}; + // If failed to parse the domain or IP address, original input should be returned + + const QString host = QUrl(url).host(); + if (host.isEmpty()) + return url; // host is in IP format if (!QHostAddress(host).isNull()) @@ -505,10 +508,8 @@ void TrackerFiltersList::addItems(const QString &trackerURL, const QVector torrentIDs = m_trackers.value(host).torrents; - if (torrentIDs.empty()) - return; + QSet torrentIDs = m_trackers.value(host).torrents; torrentIDs.remove(id); QListWidgetItem *trackerItem = nullptr;