mirror of
https://github.com/transmission/transmission
synced 2024-12-27 01:57:52 +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,18 +730,23 @@ 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->anyDate = now;
|
||||
|
||||
// tr_resume::load() calls a lot of tr_torrentSetFoo() methods
|
||||
// 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
|
||||
// affect the 'is dirty' flag.
|
||||
auto const was_dirty = tor->isDirty;
|
||||
bool resume_file_was_migrated = false;
|
||||
auto const loaded = tr_resume::load(tor, tr_resume::All, ctor, &resume_file_was_migrated);
|
||||
tor->isDirty = was_dirty;
|
||||
|
||||
if (resume_file_was_migrated)
|
||||
tr_resume::fields_t loaded = {};
|
||||
if (tor->hasMetainfo())
|
||||
{
|
||||
tr_torrent_metainfo::migrateFile(session->torrent_dir, tor->name(), tor->infoHashString(), ".torrent"sv);
|
||||
// tr_resume::load() calls a lot of tr_torrentSetFoo() methods
|
||||
// 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
|
||||
// affect the 'is dirty' flag.
|
||||
auto const was_dirty = tor->isDirty;
|
||||
|
||||
bool resume_file_was_migrated = false;
|
||||
loaded = tr_resume::load(tor, tr_resume::All, ctor, &resume_file_was_migrated);
|
||||
tor->isDirty = was_dirty;
|
||||
|
||||
if (resume_file_was_migrated)
|
||||
{
|
||||
tr_torrent_metainfo::migrateFile(session->torrent_dir, tor->name(), tor->infoHashString(), ".torrent"sv);
|
||||
}
|
||||
}
|
||||
|
||||
tor->completeness = tor->completion.status();
|
||||
|
|
Loading…
Reference in a new issue