mirror of
https://github.com/transmission/transmission
synced 2024-12-27 18:18:10 +00:00
fix: do not load magnet file resume files (#2940)
This commit is contained in:
parent
1f17ab64be
commit
af49e0f1af
1 changed files with 16 additions and 11 deletions
|
@ -730,19 +730,24 @@ static void torrentInit(tr_torrent* tor, tr_ctor const* ctor)
|
||||||
tor->addedDate = now; // this is a default that will be overwritten by the resume file
|
tor->addedDate = now; // this is a default that will be overwritten by the resume file
|
||||||
tor->anyDate = now;
|
tor->anyDate = now;
|
||||||
|
|
||||||
|
tr_resume::fields_t loaded = {};
|
||||||
|
if (tor->hasMetainfo())
|
||||||
|
{
|
||||||
// tr_resume::load() calls a lot of tr_torrentSetFoo() methods
|
// tr_resume::load() calls a lot of tr_torrentSetFoo() methods
|
||||||
// that set things as dirty, but... these settings being loaded are
|
// that set things as dirty, but... these settings being loaded are
|
||||||
// the same ones that would be saved back again, so don't let them
|
// the same ones that would be saved back again, so don't let them
|
||||||
// affect the 'is dirty' flag.
|
// affect the 'is dirty' flag.
|
||||||
auto const was_dirty = tor->isDirty;
|
auto const was_dirty = tor->isDirty;
|
||||||
|
|
||||||
bool resume_file_was_migrated = false;
|
bool resume_file_was_migrated = false;
|
||||||
auto const loaded = tr_resume::load(tor, tr_resume::All, ctor, &resume_file_was_migrated);
|
loaded = tr_resume::load(tor, tr_resume::All, ctor, &resume_file_was_migrated);
|
||||||
tor->isDirty = was_dirty;
|
tor->isDirty = was_dirty;
|
||||||
|
|
||||||
if (resume_file_was_migrated)
|
if (resume_file_was_migrated)
|
||||||
{
|
{
|
||||||
tr_torrent_metainfo::migrateFile(session->torrent_dir, tor->name(), tor->infoHashString(), ".torrent"sv);
|
tr_torrent_metainfo::migrateFile(session->torrent_dir, tor->name(), tor->infoHashString(), ".torrent"sv);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
tor->completeness = tor->completion.status();
|
tor->completeness = tor->completion.status();
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue