Skip to content

Commit

Permalink
fix: display correct tracker port in qt torrent-details (#4846)
Browse files Browse the repository at this point in the history
  • Loading branch information
ckerr committed Feb 12, 2023
1 parent 8cee2f9 commit 2b35785
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions qt/TrackerDelegate.cc
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
#include <QPixmap>
#include <QTextDocument>

#include <libtransmission/web-utils.h>

#include "FaviconCache.h"
#include "Formatter.h"
#include "Torrent.h"
Expand Down Expand Up @@ -191,9 +193,13 @@ QString TrackerDelegate::getText(TrackerInfo const& inf) const

// hostname
str += inf.st.is_backup ? QStringLiteral("<i>") : QStringLiteral("<b>");
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("</i>") : QStringLiteral("</b>");

// announce & scrape info
Expand Down

0 comments on commit 2b35785

Please sign in to comment.