summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWolfgang Bauer <[email protected]>2017-12-06 12:58:43 +0100
committerWolfgang Bauer <[email protected]>2017-12-06 12:58:43 +0100
commit4d5058bda83914346f9a020ac471ffb86201e649 (patch)
tree11ca39487bf4ace0598af3bb1fb5cc6deb94fd80
parentc4255c2894f5625407ca40e1e1c162c0b1a2a5d6 (diff)
Fix torrent download with remote .torrent files
In case of a remote Url, the .torrent file is downloaded to a temporary location first, and then that local file is used as source for the actual torrent download. But QUrl::QUrl() (that's used implicitly here to convert the QString to QUrl) expects an Url, passing it a local path (without "file://") results in an invalid Url which caused the download to fail. Using QUrl::fromLocalFile() to convert the local path to QUrl fixes that problem.
-rw-r--r--transfer-plugins/bittorrent/bttransfer.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/transfer-plugins/bittorrent/bttransfer.cpp b/transfer-plugins/bittorrent/bttransfer.cpp
index b5f804b..98aa071 100644
--- a/transfer-plugins/bittorrent/bttransfer.cpp
+++ b/transfer-plugins/bittorrent/bttransfer.cpp
@@ -128,7 +128,7 @@ void BTTransfer::start()
{
qCDebug(KGET_DEBUG) << m_dest.path();
m_tmpTorrentFile = QString(KStandardDirs::locateLocal("appdata", "tmp/") + m_dest.fileName());
- Download *download = new Download(m_source, m_tmpTorrentFile);
+ Download *download = new Download(m_source, QUrl::fromLocalFile(m_tmpTorrentFile));
setStatus(Job::Stopped, i18n("Downloading Torrent File...."), SmallIcon("document-save"));
setTransferChange(Tc_Status, true);
@@ -458,7 +458,7 @@ void BTTransfer::btTransferInit(const QUrl &src, const QByteArray &data)
m_dest = m_dest.adjusted(QUrl::StripTrailingSlash);
torrent->init(nullptr, file.readAll(), m_tmp + m_source.fileName().remove(".torrent"), QUrl::fromLocalFile(m_dest.adjusted(QUrl::RemoveFilename).path()).toLocalFile());
- m_dest = torrent->getStats().output_path;
+ m_dest = QUrl::fromLocalFile(torrent->getStats().output_path);
if (!torrent->getStats().multi_file_torrent && (m_dest.fileName() != torrent->getStats().torrent_name))//TODO check if this is needed, so if that case is true at some point
{
m_dest = m_dest.adjusted(QUrl::StripTrailingSlash);