From 1b81356a67f05bc6f6d0e741a3c9fe17a20775db Mon Sep 17 00:00:00 2001 From: Tom Piccirello Date: Sun, 4 Nov 2018 14:21:31 -0500 Subject: [PATCH] Handle downloading .torrent file as success We don't know whether the download will be successful, so default to success. Closes #9811. --- src/base/bittorrent/session.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/base/bittorrent/session.cpp b/src/base/bittorrent/session.cpp index fe27f6ef5..f0411c9d7 100644 --- a/src/base/bittorrent/session.cpp +++ b/src/base/bittorrent/session.cpp @@ -2087,10 +2087,10 @@ TorrentStatusReport Session::torrentStatusReport() const bool Session::addTorrent(QString source, const AddTorrentParams ¶ms) { MagnetUri magnetUri(source); - if (magnetUri.isValid()) { + if (magnetUri.isValid()) return addTorrent_impl(params, magnetUri); - } - else if (Utils::Misc::isUrl(source)) { + + if (Utils::Misc::isUrl(source)) { LogMsg(tr("Downloading '%1', please wait...", "e.g: Downloading 'xxx.torrent', please wait...").arg(source)); // Launch downloader Net::DownloadHandler *handler = @@ -2100,13 +2100,13 @@ bool Session::addTorrent(QString source, const AddTorrentParams ¶ms) connect(handler, &Net::DownloadHandler::downloadFailed, this, &Session::handleDownloadFailed); connect(handler, &Net::DownloadHandler::redirectedToMagnet, this, &Session::handleRedirectedToMagnet); m_downloadedTorrents[handler->url()] = params; + return true; } - else { - TorrentFileGuard guard(source); - if (addTorrent_impl(params, MagnetUri(), TorrentInfo::loadFromFile(source))) { - guard.markAsAddedToSession(); - return true; - } + + TorrentFileGuard guard(source); + if (addTorrent_impl(params, MagnetUri(), TorrentInfo::loadFromFile(source))) { + guard.markAsAddedToSession(); + return true; } return false;