Members of the KDE Community are recommended to subscribe to the kde-community mailing list at to allow them to participate in important discussions and receive other important announcements

Commit 4d5058bd authored by Wolfgang Bauer's avatar Wolfgang Bauer

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
parent c4255c28
......@@ -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);
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment