mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-08-20 13:23:34 -07:00
in setCommentAction() ensure hash matches a comment before all other steps
This commit is contained in:
parent
830ccb1532
commit
1ed05c7d9e
1 changed files with 1 additions and 1 deletions
|
@ -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);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue