mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2025-12-20 07:27:22 -06:00
Fix duplicate torrent detection when adding a magnet link
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
* Unreleased - Christophe Dumez <chris@qbittorrent.org> - v2.9.5
|
* Unreleased - Christophe Dumez <chris@qbittorrent.org> - v2.9.5
|
||||||
- BUGFIX: Fix crash when disabling then reenabling RSS
|
- BUGFIX: Fix crash when disabling then reenabling RSS
|
||||||
|
- BUGFIX: Fix duplicate torrent detection when adding a magnet link
|
||||||
|
|
||||||
* Sat Feb 18 2012 - Christophe Dumez <chris@qbittorrent.org> - v2.9.4
|
* Sat Feb 18 2012 - Christophe Dumez <chris@qbittorrent.org> - v2.9.4
|
||||||
- BUGFIX: qBittorrent does not handle redirection to relative URLs correctly (Closes #919905)
|
- BUGFIX: qBittorrent does not handle redirection to relative URLs correctly (Closes #919905)
|
||||||
|
|||||||
@@ -80,10 +80,6 @@ public:
|
|||||||
return QString(o.str().c_str());
|
return QString(o.str().c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline libtorrent::sha1_hash toSha1Hash(const QString &hash) {
|
|
||||||
return libtorrent::sha1_hash(hash.toAscii().constData());
|
|
||||||
}
|
|
||||||
|
|
||||||
static void chmod644(const QDir& folder);
|
static void chmod644(const QDir& folder);
|
||||||
|
|
||||||
static inline QString removeLastPathPart(QString path) {
|
static inline QString removeLastPathPart(QString path) {
|
||||||
@@ -95,7 +91,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
static inline libtorrent::sha1_hash QStringToSha1(const QString& s) {
|
static inline libtorrent::sha1_hash QStringToSha1(const QString& s) {
|
||||||
std::string str(s.toLocal8Bit().data());
|
std::string str(s.toAscii().data());
|
||||||
std::istringstream i(str);
|
std::istringstream i(str);
|
||||||
libtorrent::sha1_hash x;
|
libtorrent::sha1_hash x;
|
||||||
i>>x;
|
i>>x;
|
||||||
|
|||||||
@@ -900,7 +900,7 @@ QTorrentHandle QBtSession::addMagnetUri(QString magnet_uri, bool resumed) {
|
|||||||
Q_ASSERT(magnet_uri.startsWith("magnet:", Qt::CaseInsensitive));
|
Q_ASSERT(magnet_uri.startsWith("magnet:", Qt::CaseInsensitive));
|
||||||
|
|
||||||
// Check for duplicate torrent
|
// Check for duplicate torrent
|
||||||
if(s->find_torrent(misc::toSha1Hash(hash)).is_valid()) {
|
if(s->find_torrent(misc::QStringToSha1(hash)).is_valid()) {
|
||||||
qDebug("/!\\ Torrent is already in download list");
|
qDebug("/!\\ Torrent is already in download list");
|
||||||
addConsoleMessage(tr("'%1' is already in download list.", "e.g: 'xxx.avi' is already in download list.").arg(magnet_uri));
|
addConsoleMessage(tr("'%1' is already in download list.", "e.g: 'xxx.avi' is already in download list.").arg(magnet_uri));
|
||||||
return h;
|
return h;
|
||||||
|
|||||||
Reference in New Issue
Block a user