From 122ba102f5b5bc687721f0ae8d25027de8e30f3e Mon Sep 17 00:00:00 2001 From: Chocobo1 Date: Thu, 26 Dec 2024 15:35:04 +0800 Subject: [PATCH] Fix cannot remove trackers The backport commit c3c7f28bad0a3e874e6883d98e422c6716f8e77a was insufficient. Closes 22039. --- src/webui/api/torrentscontroller.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/webui/api/torrentscontroller.cpp b/src/webui/api/torrentscontroller.cpp index 74272921be72..0a0bc884c41c 100644 --- a/src/webui/api/torrentscontroller.cpp +++ b/src/webui/api/torrentscontroller.cpp @@ -880,7 +880,13 @@ void TorrentsController::removeTrackersAction() if (!torrent) throw APIError(APIErrorType::NotFound); - const QStringList urls = params()[u"urls"_s].split(u'|'); + const QStringList urlsParam = params()[u"urls"_s].split(u'|', Qt::SkipEmptyParts); + + QStringList urls; + urls.reserve(urlsParam.size()); + for (const QString &urlStr : urlsParam) + urls << QUrl::fromPercentEncoding(urlStr.toLatin1()); + torrent->removeTrackers(urls); if (!torrent->isStopped())