From 3ec118d59bc74df8bb2b3a7ace2c8308ea03f14d Mon Sep 17 00:00:00 2001 From: Christophe Dumez Date: Sun, 6 Dec 2009 14:41:05 +0000 Subject: [PATCH] - When downloading a torrent from its URL in Web UI, the torrent addition dialog was not skipped and displayed on server side. * Regression introduced in a recent release candidate --- src/bittorrent.cpp | 18 ++++++++++-------- src/bittorrent.h | 6 ++++-- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/src/bittorrent.cpp b/src/bittorrent.cpp index ff42162e0..6ecb50755 100644 --- a/src/bittorrent.cpp +++ b/src/bittorrent.cpp @@ -198,11 +198,12 @@ void Bittorrent::setUploadLimit(QString hash, long val) { void Bittorrent::handleDownloadFailure(QString url, QString reason) { emit downloadFromUrlFailure(url, reason); // Clean up - int index = url_skippingDlg.indexOf(url); + QUrl qurl = QUrl::fromEncoded(url.toLocal8Bit()); + int index = url_skippingDlg.indexOf(qurl); if(index >= 0) url_skippingDlg.removeAt(index); - if(savepath_fromurl.contains(url)) - savepath_fromurl.remove(url); + if(savepath_fromurl.contains(qurl)) + savepath_fromurl.remove(qurl); } void Bittorrent::startTorrentsInPause(bool b) { @@ -842,9 +843,9 @@ QTorrentHandle Bittorrent::addTorrent(QString path, bool fromScanDir, QString fr } } QString savePath; - if(!from_url.isEmpty() && savepath_fromurl.contains(from_url)) { + if(!from_url.isEmpty() && savepath_fromurl.contains(QUrl::fromEncoded(from_url.toLocal8Bit()))) { // Enforcing the save path defined before URL download (from RSS for example) - savePath = savepath_fromurl.take(from_url); + savePath = savepath_fromurl.take(QUrl::fromEncoded(from_url.toLocal8Bit())); } else { savePath = getSavePath(hash); } @@ -1702,16 +1703,17 @@ void Bittorrent::addMagnetSkipAddDlg(QString uri) { void Bittorrent::downloadUrlAndSkipDialog(QString url, QString save_path) { //emit aboutToDownloadFromUrl(url); + QUrl qurl = QUrl::fromEncoded(url.toLocal8Bit()); if(!save_path.isEmpty()) - savepath_fromurl[url] = save_path; - url_skippingDlg << url; + savepath_fromurl[qurl] = save_path; + url_skippingDlg << qurl; // Launch downloader thread downloader->downloadUrl(url); } // Add to Bittorrent session the downloaded torrent file void Bittorrent::processDownloadedFile(QString url, QString file_path) { - int index = url_skippingDlg.indexOf(url); + int index = url_skippingDlg.indexOf(QUrl::fromEncoded(url.toLocal8Bit())); if(index < 0) { // Add file to torrent download list emit newDownloadedTorrent(file_path, url); diff --git a/src/bittorrent.h b/src/bittorrent.h index e2d8116d1..8ea40788f 100644 --- a/src/bittorrent.h +++ b/src/bittorrent.h @@ -31,6 +31,8 @@ #define __BITTORRENT_H__ #include +#include +#include #include #include #include @@ -86,7 +88,7 @@ private: // Bittorrent session *s; QPointer timerAlerts; - QHash savepath_fromurl; + QMap savepath_fromurl; QHash > trackersInfos; // Ratio QPointer BigRatioTimer; @@ -119,7 +121,7 @@ private: QString filterPath; // Web UI QPointer httpServer; - QStringList url_skippingDlg; + QList url_skippingDlg; // Fast exit (async) bool exiting;