Don't stuck loading on mismatching info-hashes in resume data

PR #20262.
Closes #20251.
This commit is contained in:
Vladimir Golovnev
2024-01-13 18:08:16 +03:00
committed by GitHub
parent 97c0abcbf0
commit 14513d051d
3 changed files with 34 additions and 13 deletions

View File

@@ -288,6 +288,16 @@ BitTorrent::LoadResumeDataResult BitTorrent::BencodeResumeDataStorage::loadTorre
return nonstd::make_unexpected(tr("Cannot parse torrent info: %1").arg(QString::fromStdString(ec.message())));
p.ti = torrentInfo;
#ifdef QBT_USES_LIBTORRENT2
if (((p.info_hashes.has_v1() && (p.info_hashes.v1 != p.ti->info_hashes().v1))
|| (p.info_hashes.has_v2() && (p.info_hashes.v2 != p.ti->info_hashes().v2))))
#else
if (!p.info_hash.is_all_zeros() && (p.info_hash != p.ti->info_hash()))
#endif
{
return nonstd::make_unexpected(tr("Mismatching info-hash detected in resume data"));
}
}
p.save_path = Profile::instance()->fromPortablePath(