mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2026-01-01 13:18:06 -06:00
Make TorrentInfo immutable
This commit is contained in:
@@ -573,10 +573,12 @@ void SyncController::torrentPeersAction()
|
||||
{KEY_PEER_CONNECTION_TYPE, pi.connectionType()},
|
||||
{KEY_PEER_FLAGS, pi.flags()},
|
||||
{KEY_PEER_FLAGS_DESCRIPTION, pi.flagsDescription()},
|
||||
{KEY_PEER_RELEVANCE, pi.relevance()},
|
||||
{KEY_PEER_FILES, torrent->info().filesForPiece(pi.downloadingPieceIndex()).join('\n')}
|
||||
{KEY_PEER_RELEVANCE, pi.relevance()}
|
||||
};
|
||||
|
||||
if (torrent->hasMetadata())
|
||||
peer.insert(KEY_PEER_FILES, torrent->info().filesForPiece(pi.downloadingPieceIndex()).join('\n'));
|
||||
|
||||
if (resolvePeerCountries)
|
||||
{
|
||||
peer[KEY_PEER_COUNTRY_CODE] = pi.country().toLower();
|
||||
|
||||
@@ -594,9 +594,12 @@ void TorrentsController::pieceHashesAction()
|
||||
throw APIError(APIErrorType::NotFound);
|
||||
|
||||
QJsonArray pieceHashes;
|
||||
const QVector<QByteArray> hashes = torrent->info().pieceHashes();
|
||||
for (const QByteArray &hash : hashes)
|
||||
pieceHashes.append(QString(hash.toHex()));
|
||||
if (torrent->hasMetadata())
|
||||
{
|
||||
const QVector<QByteArray> hashes = torrent->info().pieceHashes();
|
||||
for (const QByteArray &hash : hashes)
|
||||
pieceHashes.append(QString(hash.toHex()));
|
||||
}
|
||||
|
||||
setResult(pieceHashes);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user