diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/downloadmanager.cpp | 32 |
1 files changed, 14 insertions, 18 deletions
diff --git a/src/downloadmanager.cpp b/src/downloadmanager.cpp index adfbc84d..fa2c959c 100644 --- a/src/downloadmanager.cpp +++ b/src/downloadmanager.cpp @@ -1823,8 +1823,14 @@ void DownloadManager::nxmFileInfoFromMd5Available(QString gameName, QVariant use auto fileDetails = results["file_details"].toMap(); if (fileDetails["file_name"].toString().compare(info->m_FileName, Qt::CaseInsensitive) == 0) { - chosenIdx = i; - break; + if (chosenIdx < 0) { + chosenIdx = i; //intentional to not break in order to check other results + } + else { + log::debug("Multiple files with same name found during MD5 search."); + chosenIdx = -1; + break; + } } } } @@ -1839,7 +1845,7 @@ void DownloadManager::nxmFileInfoFromMd5Available(QString gameName, QVariant use if (chosenIdx < 0) { chosenIdx = i; //intentional to not break in order to check other results } else { - log::debug("Multiple active files found during MD5 search. Defaulting to time stamps..."); + log::debug("Multiple active files found during MD5 search."); chosenIdx = -1; break; } @@ -1847,24 +1853,14 @@ void DownloadManager::nxmFileInfoFromMd5Available(QString gameName, QVariant use } } - //Look for the most recent one + //Unable to determine the correct mod / file. Revert to the old method if (chosenIdx < 0) { - int mostRecentTime = INT_MIN; - for (int i = 0; i < resultlist.count(); i++) { - auto results = resultlist[i].toMap(); - auto fileDetails = results["file_details"].toMap(); - - int fileTime = fileDetails["uploaded_timestamp"].toInt(); - if (fileTime > mostRecentTime) { - chosenIdx = i; - mostRecentTime = fileTime; - } - } + //don't use the normal state set function as we don't want to create a meta file + info->m_State = DownloadManager::STATE_READY; + queryInfo(m_ActiveDownloads.indexOf(info)); + return; } - //If nothing is preferred, just use the first one - if (chosenIdx < 0) chosenIdx = 0; - auto results = resultlist[chosenIdx].toMap(); auto fileDetails = results["file_details"].toMap(); auto modDetails = results["mod"].toMap(); |
