Try to recover missing tags

Tags can go missing from config/resume data. Try to recover them to avoid inconsistent behavior.

Original PR: #17290.
This commit is contained in:
summer 2022-06-29 10:17:52 +06:00 committed by Chocobo1
parent 26d78f6462
commit b53eadaec8

View file

@ -4537,6 +4537,24 @@ void Session::startUpTorrents()
}
}
Algorithm::removeIf(resumeData.tags, [this, &torrentID](const QString &tag)
{
if (hasTag(tag))
return false;
if (addTag(tag))
{
LogMsg(tr("Detected inconsistent data: tag is missing from the configuration file."
" Tag will be recovered."
" Torrent: \"%1\". Tag: \"%2\"").arg(torrentID.toString(), tag), Log::WARNING);
return false;
}
LogMsg(tr("Detected inconsistent data: invalid tag. Torrent: \"%1\". Tag: \"%2\"")
.arg(torrentID.toString(), tag), Log::WARNING);
return true;
});
qDebug() << "Starting up torrent" << torrentID.toString() << "...";
if (!loadTorrent(resumeData))
{