mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2025-12-19 23:17:21 -06:00
BUGFIX: Force data recheck whenever a torrent is moved
BUGFIX: Detect existing torrent data even if incomplete torrents are saved to a different folder
This commit is contained in:
@@ -702,11 +702,13 @@ QTorrentHandle Bittorrent::addMagnetUri(QString magnet_uri, bool resumed) {
|
||||
}
|
||||
}
|
||||
QString savePath = getSavePath(hash);
|
||||
qDebug("addMagnetURI: using save_path: %s", savePath.toLocal8Bit().data());
|
||||
if(defaultTempPath.isEmpty() || (resumed && TorrentPersistentData::isSeed(hash))) {
|
||||
p.save_path = savePath.toLocal8Bit().data();
|
||||
} else {
|
||||
if(!defaultTempPath.isEmpty() && resumed && !TorrentPersistentData::isSeed(hash)) {
|
||||
qDebug("addMagnetURI: Temp folder is enabled.");
|
||||
p.save_path = defaultTempPath.toLocal8Bit().data();
|
||||
qDebug("addMagnetURI: using save_path: %s", defaultTempPath.toLocal8Bit().data());
|
||||
} else {
|
||||
p.save_path = savePath.toLocal8Bit().data();
|
||||
qDebug("addMagnetURI: using save_path: %s", savePath.toLocal8Bit().data());
|
||||
}
|
||||
// Preallocate all?
|
||||
if(preAllocateAll)
|
||||
@@ -730,6 +732,13 @@ QTorrentHandle Bittorrent::addMagnetUri(QString magnet_uri, bool resumed) {
|
||||
return h;
|
||||
}
|
||||
Q_ASSERT(h.hash() == hash);
|
||||
|
||||
// If temp path is enabled, move torrent
|
||||
if(!defaultTempPath.isEmpty() && !resumed) {
|
||||
qDebug("Temp folder is enabled, moving new torrent to temp folder");
|
||||
h.move_storage(defaultTempPath);
|
||||
}
|
||||
|
||||
// Connections limit per torrent
|
||||
h.set_max_connections(Preferences::getMaxConnecsPerTorrent());
|
||||
// Uploads limit per torrent
|
||||
@@ -854,11 +863,13 @@ QTorrentHandle Bittorrent::addTorrent(QString path, bool fromScanDir, QString fr
|
||||
} else {
|
||||
savePath = getSavePath(hash);
|
||||
}
|
||||
qDebug("addTorrent: using save_path: %s", savePath.toLocal8Bit().data());
|
||||
if(defaultTempPath.isEmpty() || (resumed && TorrentPersistentData::isSeed(hash))) {
|
||||
p.save_path = savePath.toLocal8Bit().data();
|
||||
} else {
|
||||
if(!defaultTempPath.isEmpty() && resumed && !TorrentPersistentData::isSeed(hash)) {
|
||||
qDebug("addTorrent::Temp folder is enabled.");
|
||||
p.save_path = defaultTempPath.toLocal8Bit().data();
|
||||
qDebug("addTorrent: using save_path: %s", defaultTempPath.toLocal8Bit().data());
|
||||
} else {
|
||||
p.save_path = savePath.toLocal8Bit().data();
|
||||
qDebug("addTorrent: using save_path: %s", savePath.toLocal8Bit().data());
|
||||
}
|
||||
|
||||
#ifdef LIBTORRENT_0_15
|
||||
@@ -899,6 +910,12 @@ QTorrentHandle Bittorrent::addTorrent(QString path, bool fromScanDir, QString fr
|
||||
return h;
|
||||
}
|
||||
|
||||
// If temp path is enabled, move torrent
|
||||
if(!defaultTempPath.isEmpty() && !resumed) {
|
||||
qDebug("Temp folder is enabled, moving new torrent to temp folder");
|
||||
h.move_storage(defaultTempPath);
|
||||
}
|
||||
|
||||
// Connections limit per torrent
|
||||
h.set_max_connections(Preferences::getMaxConnecsPerTorrent());
|
||||
// Uploads limit per torrent
|
||||
@@ -1495,6 +1512,11 @@ void Bittorrent::readAlerts() {
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (storage_moved_alert* p = dynamic_cast<storage_moved_alert*>(a.get())) {
|
||||
QTorrentHandle h(p->handle);
|
||||
if(h.is_valid())
|
||||
h.force_recheck(); //XXX: Required by libtorrent for now
|
||||
}
|
||||
else if (metadata_received_alert* p = dynamic_cast<metadata_received_alert*>(a.get())) {
|
||||
QTorrentHandle h(p->handle);
|
||||
if(h.is_valid()) {
|
||||
|
||||
Reference in New Issue
Block a user