From 2b3578512cc14ad584d8b128dbdca1e889c10c8b Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Sat, 11 Feb 2023 21:46:57 -0600 Subject: [PATCH] fix: display correct tracker port in qt torrent-details (#4846) --- qt/TrackerDelegate.cc | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/qt/TrackerDelegate.cc b/qt/TrackerDelegate.cc index 6df0be68e..3afb13282 100644 --- a/qt/TrackerDelegate.cc +++ b/qt/TrackerDelegate.cc @@ -9,6 +9,8 @@ #include #include +#include + #include "FaviconCache.h" #include "Formatter.h" #include "Torrent.h" @@ -191,9 +193,13 @@ QString TrackerDelegate::getText(TrackerInfo const& inf) const // hostname str += inf.st.is_backup ? QStringLiteral("") : QStringLiteral(""); - auto const url = QUrl(inf.st.announce); - str += QStringLiteral("%1:%2").arg(url.host()).arg(url.port(80)); - + auto const announce_url = inf.st.announce.toStdString(); + if (auto const parsed = tr_urlParse(announce_url); parsed) + { + str += QStringLiteral("%1:%2") + .arg(QString::fromUtf8(std::data(parsed->host), std::size(parsed->host))) + .arg(parsed->port); + } str += inf.st.is_backup ? QStringLiteral("") : QStringLiteral(""); // announce & scrape info