From e7370d1a0f956c64f87577a242aee3bcc25a5028 Mon Sep 17 00:00:00 2001 From: Vladimir Golovnev Date: Tue, 4 Oct 2022 19:41:36 +0300 Subject: [PATCH] Don't pollute move queue by torrents w/o metadata There's really nothing to move if the torrent still doesn't have metadata. Additionally, such torrents in the queue can lead to unexpected behavior when reloading the torrent after metadata is received. PR #17823. --- src/base/bittorrent/torrentimpl.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/base/bittorrent/torrentimpl.cpp b/src/base/bittorrent/torrentimpl.cpp index b563f7d88..3a919d1f1 100644 --- a/src/base/bittorrent/torrentimpl.cpp +++ b/src/base/bittorrent/torrentimpl.cpp @@ -504,6 +504,9 @@ void TorrentImpl::setAutoTMMEnabled(bool enabled) Path TorrentImpl::actualStorageLocation() const { + if (!hasMetadata()) + return {}; + return Path(m_nativeStatus.save_path); } @@ -1690,6 +1693,12 @@ void TorrentImpl::resume(const TorrentOperatingMode mode) void TorrentImpl::moveStorage(const Path &newPath, const MoveStorageMode mode) { + if (!hasMetadata()) + { + m_session->handleTorrentSavePathChanged(this); + return; + } + if (m_session->addMoveTorrentStorageJob(this, newPath, mode)) { m_storageIsMoving = true;