From aada4f3c034a49bea92e1aefb7f9e1451ebefccc Mon Sep 17 00:00:00 2001 From: Christophe Dumez Date: Tue, 11 Dec 2007 20:00:43 +0000 Subject: [PATCH] - Forgot to remove temporary download file when addition failed --- src/bittorrent.cpp | 3 +++ src/torrentAddition.h | 3 +++ 2 files changed, 6 insertions(+) diff --git a/src/bittorrent.cpp b/src/bittorrent.cpp index 23b8d1e31..7fb4ade4a 100644 --- a/src/bittorrent.cpp +++ b/src/bittorrent.cpp @@ -530,6 +530,7 @@ void bittorrent::addTorrent(QString path, bool fromScanDir, QString from_url, bo // Display warning to tell user we can't decode the torrent file if(!from_url.isNull()) { emit invalidTorrent(from_url); + QFile::remove(file); }else{ emit invalidTorrent(file); } @@ -544,6 +545,8 @@ void bittorrent::addTorrent(QString path, bool fromScanDir, QString from_url, bo // Display warning to tell user we can't decode the torrent file if(!from_url.isNull()) { emit invalidTorrent(from_url); + qDebug("File path is: %s", file.toUtf8().data()); + QFile::remove(file); }else{ emit invalidTorrent(file); } diff --git a/src/torrentAddition.h b/src/torrentAddition.h index 255b23bf6..ca4c865b1 100644 --- a/src/torrentAddition.h +++ b/src/torrentAddition.h @@ -125,6 +125,7 @@ class torrentAdditionDialog : public QDialog, private Ui_addTorrentDialog{ // Display warning to tell user we can't decode the torrent file if(!from_url.isNull()){ emit setInfoBarGUI(tr("Unable to decode torrent file:")+QString::fromUtf8(" '")+from_url+QString::fromUtf8("'"), QString::fromUtf8("red")); + QFile::remove(filePath); }else{ emit setInfoBarGUI(tr("Unable to decode torrent file:")+QString::fromUtf8(" '")+filePath+QString::fromUtf8("'"), QString::fromUtf8("red")); } @@ -142,9 +143,11 @@ class torrentAdditionDialog : public QDialog, private Ui_addTorrentDialog{ // Display warning to tell user we can't decode the torrent file if(!from_url.isNull()){ emit setInfoBarGUI(tr("Unable to decode torrent file:")+QString::fromUtf8(" '")+from_url+QString::fromUtf8("'"), QString::fromUtf8("red")); + QFile::remove(filePath); }else{ emit setInfoBarGUI(tr("Unable to decode torrent file:")+QString::fromUtf8(" '")+filePath+QString::fromUtf8("'"), QString::fromUtf8("red")); } + qDebug("path is %s", filePath.toUtf8().data()); emit setInfoBarGUI(tr("This file is either corrupted or this isn't a torrent."), QString::fromUtf8("red")); if(fromScanDir){ // Remove .corrupt file in case it already exists