Fix cannot remove trackers via WebAPI

The backport commit c3c7f28bad was insufficient.

Closes 22039.
PR #22071.
This commit is contained in:
Chocobo1 2024-12-29 14:40:17 +08:00 committed by GitHub
parent 0188e11dd7
commit 35dce07c63
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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())