From 1ed05c7d9e0f08ef53219ab4621bfab7497fb7fe Mon Sep 17 00:00:00 2001 From: HamletDuFromage <61667930+HamletDuFromage@users.noreply.github.com> Date: Fri, 25 Jul 2025 21:38:33 +0200 Subject: [PATCH] in setCommentAction() ensure hash matches a comment before all other steps --- src/webui/api/torrentscontroller.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/webui/api/torrentscontroller.cpp b/src/webui/api/torrentscontroller.cpp index 065830f48..5a087f87b 100644 --- a/src/webui/api/torrentscontroller.cpp +++ b/src/webui/api/torrentscontroller.cpp @@ -2149,12 +2149,12 @@ void TorrentsController::setCommentAction() requireParams({u"hash"_s, u"comment"_s}); const auto id = BitTorrent::TorrentID::fromString(params()[u"hash"_s]); - QString comment = params()[u"comment"_s].trimmed(); BitTorrent::Torrent *const torrent = BitTorrent::Session::instance()->getTorrent(id); if (!torrent) throw APIError(APIErrorType::NotFound); + QString comment = params()[u"comment"_s].trimmed(); comment.replace(QRegularExpression(u"\r?\n|\r"_s), u" "_s); torrent->setComment(comment);