mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-07-15 09:43:07 -07:00
Handle downloading .torrent file as success
We don't know whether the download will be successful, so default to success. Closes #9811.
This commit is contained in:
parent
a57a026f4c
commit
1b81356a67
1 changed files with 9 additions and 9 deletions
|
@ -2087,10 +2087,10 @@ TorrentStatusReport Session::torrentStatusReport() const
|
||||||
bool Session::addTorrent(QString source, const AddTorrentParams ¶ms)
|
bool Session::addTorrent(QString source, const AddTorrentParams ¶ms)
|
||||||
{
|
{
|
||||||
MagnetUri magnetUri(source);
|
MagnetUri magnetUri(source);
|
||||||
if (magnetUri.isValid()) {
|
if (magnetUri.isValid())
|
||||||
return addTorrent_impl(params, magnetUri);
|
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));
|
LogMsg(tr("Downloading '%1', please wait...", "e.g: Downloading 'xxx.torrent', please wait...").arg(source));
|
||||||
// Launch downloader
|
// Launch downloader
|
||||||
Net::DownloadHandler *handler =
|
Net::DownloadHandler *handler =
|
||||||
|
@ -2100,14 +2100,14 @@ bool Session::addTorrent(QString source, const AddTorrentParams ¶ms)
|
||||||
connect(handler, &Net::DownloadHandler::downloadFailed, this, &Session::handleDownloadFailed);
|
connect(handler, &Net::DownloadHandler::downloadFailed, this, &Session::handleDownloadFailed);
|
||||||
connect(handler, &Net::DownloadHandler::redirectedToMagnet, this, &Session::handleRedirectedToMagnet);
|
connect(handler, &Net::DownloadHandler::redirectedToMagnet, this, &Session::handleRedirectedToMagnet);
|
||||||
m_downloadedTorrents[handler->url()] = params;
|
m_downloadedTorrents[handler->url()] = params;
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
TorrentFileGuard guard(source);
|
TorrentFileGuard guard(source);
|
||||||
if (addTorrent_impl(params, MagnetUri(), TorrentInfo::loadFromFile(source))) {
|
if (addTorrent_impl(params, MagnetUri(), TorrentInfo::loadFromFile(source))) {
|
||||||
guard.markAsAddedToSession();
|
guard.markAsAddedToSession();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue