1
0
mirror of https://github.com/d47081/qBittorrent.git synced 2025-01-11 15:27:54 +00:00

Merge pull request #10464 from thalieht/torrent-size-limit

Increase the download request size limit from 10 to 100 MiB
This commit is contained in:
Mike Tzou 2019-04-11 10:14:49 +08:00 committed by GitHub
commit 19dfec1e0a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 7 additions and 5 deletions

View File

@ -1809,7 +1809,7 @@ bool Session::addTorrent(const QString &source, const AddTorrentParams &params)
if (Net::DownloadManager::hasSupportedScheme(source)) {
LogMsg(tr("Downloading '%1', please wait...", "e.g: Downloading 'xxx.torrent', please wait...").arg(source));
// Launch downloader
Net::DownloadManager::instance()->download(Net::DownloadRequest(source).limit(10485760 /* 10MB */)
Net::DownloadManager::instance()->download(Net::DownloadRequest(source).limit(MAX_TORRENT_SIZE)
, this, &Session::handleDownloadFinished);
m_downloadedTorrents[source] = params;
return true;

View File

@ -39,7 +39,9 @@
#include <QStringList>
#include <QUrl>
#include "base/global.h"
#include "base/utils/fs.h"
#include "base/utils/misc.h"
#include "infohash.h"
#include "trackerentry.h"
@ -116,10 +118,9 @@ TorrentInfo TorrentInfo::loadFromFile(const QString &path, QString *error) noexc
return TorrentInfo();
}
const qint64 fileSizeLimit = 100 * 1024 * 1024; // 100 MB
if (file.size() > fileSizeLimit) {
if (file.size() > MAX_TORRENT_SIZE) {
if (error)
*error = tr("File size exceeds max limit %1").arg(fileSizeLimit);
*error = tr("File size exceeds max limit %1").arg(Utils::Misc::friendlyUnit(MAX_TORRENT_SIZE));
return TorrentInfo();
}

View File

@ -36,6 +36,7 @@
#endif
const char C_TORRENT_FILE_EXTENSION[] = ".torrent";
const int MAX_TORRENT_SIZE = 100 * 1024 * 1024; // 100 MiB
template <typename T>
constexpr typename std::add_const<T>::type &asConst(T &t) noexcept { return t; }

View File

@ -238,7 +238,7 @@ void AddNewTorrentDialog::show(const QString &source, const BitTorrent::AddTorre
if (Net::DownloadManager::hasSupportedScheme(source)) {
// Launch downloader
Net::DownloadManager::instance()->download(
Net::DownloadRequest(source).limit(10485760 /* 10MB */)
Net::DownloadRequest(source).limit(MAX_TORRENT_SIZE)
, dlg, &AddNewTorrentDialog::handleDownloadFinished);
return;
}