mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2024-12-27 08:19:30 +08:00
Do not remove added files unconditionally. Closes #6248
If removing of added torrents is enabled and dialog for adding torrents is disabled, file guard was assuming that torrent is added successfully. And that can be not the case if a user trying to add a broken torrent file (or not a torrent file at all). Then this file gets deleted always. Fix this by checking result of addTorrent_impl().
This commit is contained in:
parent
33ada71e4b
commit
4c13f155ff
@ -1576,8 +1576,10 @@ bool Session::addTorrent(QString source, const AddTorrentParams ¶ms)
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
TorrentFileGuard guard(source);
|
TorrentFileGuard guard(source);
|
||||||
|
if (addTorrent_impl(params, MagnetUri(), TorrentInfo::loadFromFile(source))) {
|
||||||
guard.markAsAddedToSession();
|
guard.markAsAddedToSession();
|
||||||
return addTorrent_impl(params, MagnetUri(), TorrentInfo::loadFromFile(source));
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
Loading…
Reference in New Issue
Block a user