mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-08-21 05:43:32 -07:00
WebAPI: Fix looking up hybrid torrent metadata
This commit is contained in:
parent
a72f9eb396
commit
672b98f7a0
1 changed files with 10 additions and 0 deletions
|
@ -2130,5 +2130,15 @@ void TorrentsController::onMetadataDownloaded(const BitTorrent::TorrentInfo &inf
|
|||
return;
|
||||
|
||||
if (auto iter = m_torrentMetadataCache.find(info.infoHash().toTorrentID()); iter != m_torrentMetadataCache.end())
|
||||
{
|
||||
iter.value().setTorrentInfo(info);
|
||||
}
|
||||
else if (info.infoHash().isHybrid())
|
||||
{
|
||||
// hybrid torrents use the v2 hash for their torrentID, but the torrent may have previously been stored
|
||||
// in m_torrentMetadataCache using the v1 hash, before the v2 hash was known/available
|
||||
const BitTorrent::TorrentID v1TorrentID = BitTorrent::TorrentID::fromSHA1Hash(info.infoHash().v1());
|
||||
if (auto iter = m_torrentMetadataCache.find(v1TorrentID); iter != m_torrentMetadataCache.end())
|
||||
iter.value().setTorrentInfo(info);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue