Browse Source

- 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
adaptive-webui-19844
Christophe Dumez 15 years ago
parent
commit
3ec118d59b
  1. 18
      src/bittorrent.cpp
  2. 6
      src/bittorrent.h

18
src/bittorrent.cpp

@ -198,11 +198,12 @@ void Bittorrent::setUploadLimit(QString hash, long val) {
void Bittorrent::handleDownloadFailure(QString url, QString reason) { void Bittorrent::handleDownloadFailure(QString url, QString reason) {
emit downloadFromUrlFailure(url, reason); emit downloadFromUrlFailure(url, reason);
// Clean up // Clean up
int index = url_skippingDlg.indexOf(url); QUrl qurl = QUrl::fromEncoded(url.toLocal8Bit());
int index = url_skippingDlg.indexOf(qurl);
if(index >= 0) if(index >= 0)
url_skippingDlg.removeAt(index); url_skippingDlg.removeAt(index);
if(savepath_fromurl.contains(url)) if(savepath_fromurl.contains(qurl))
savepath_fromurl.remove(url); savepath_fromurl.remove(qurl);
} }
void Bittorrent::startTorrentsInPause(bool b) { void Bittorrent::startTorrentsInPause(bool b) {
@ -842,9 +843,9 @@ QTorrentHandle Bittorrent::addTorrent(QString path, bool fromScanDir, QString fr
} }
} }
QString savePath; 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) // 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 { } else {
savePath = getSavePath(hash); savePath = getSavePath(hash);
} }
@ -1702,16 +1703,17 @@ void Bittorrent::addMagnetSkipAddDlg(QString uri) {
void Bittorrent::downloadUrlAndSkipDialog(QString url, QString save_path) { void Bittorrent::downloadUrlAndSkipDialog(QString url, QString save_path) {
//emit aboutToDownloadFromUrl(url); //emit aboutToDownloadFromUrl(url);
QUrl qurl = QUrl::fromEncoded(url.toLocal8Bit());
if(!save_path.isEmpty()) if(!save_path.isEmpty())
savepath_fromurl[url] = save_path; savepath_fromurl[qurl] = save_path;
url_skippingDlg << url; url_skippingDlg << qurl;
// Launch downloader thread // Launch downloader thread
downloader->downloadUrl(url); downloader->downloadUrl(url);
} }
// Add to Bittorrent session the downloaded torrent file // Add to Bittorrent session the downloaded torrent file
void Bittorrent::processDownloadedFile(QString url, QString file_path) { 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) { if(index < 0) {
// Add file to torrent download list // Add file to torrent download list
emit newDownloadedTorrent(file_path, url); emit newDownloadedTorrent(file_path, url);

6
src/bittorrent.h

@ -31,6 +31,8 @@
#define __BITTORRENT_H__ #define __BITTORRENT_H__
#include <QHash> #include <QHash>
#include <QMap>
#include <QUrl>
#include <QStringList> #include <QStringList>
#include <QApplication> #include <QApplication>
#include <QPalette> #include <QPalette>
@ -86,7 +88,7 @@ private:
// Bittorrent // Bittorrent
session *s; session *s;
QPointer<QTimer> timerAlerts; QPointer<QTimer> timerAlerts;
QHash<QString, QString> savepath_fromurl; QMap<QUrl, QString> savepath_fromurl;
QHash<QString, QHash<QString, TrackerInfos> > trackersInfos; QHash<QString, QHash<QString, TrackerInfos> > trackersInfos;
// Ratio // Ratio
QPointer<QTimer> BigRatioTimer; QPointer<QTimer> BigRatioTimer;
@ -119,7 +121,7 @@ private:
QString filterPath; QString filterPath;
// Web UI // Web UI
QPointer<HttpServer> httpServer; QPointer<HttpServer> httpServer;
QStringList url_skippingDlg; QList<QUrl> url_skippingDlg;
// Fast exit (async) // Fast exit (async)
bool exiting; bool exiting;

Loading…
Cancel
Save