Skip to content

Commit

Permalink
Use new version comparison to properly detect pack updates
Browse files Browse the repository at this point in the history
Removes the work-around we had previously that could see a downgrade as upgrade.
  • Loading branch information
black-sliver committed Sep 2, 2024
1 parent 8f51c4b commit 0da7e52
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions src/packmanager/packmanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -164,20 +164,18 @@ void PackManager::checkForUpdateFrom(const std::string& uid, const std::string&
Version current = Version(version);

for (auto& section: j["versions"]) {
if (!section["download_url"].is_string()) continue; // skip "null"
if (!section["download_url"].is_string())
continue; // skip "null"
std::string v = section["package_version"].get<std::string>();
if (v.empty()) continue; // skip bad version names
if (v.empty())
continue; // skip bad version names
auto ignoreIt = _ignoredSHA256.find(uid);
if (ignoreIt != _ignoredSHA256.end() &&
ignoreIt->second.count(section["sha256"].get<std::string>())) {
break;
}
Version check = Version(v);
if (check > current || (check.Major == current.Major &&
check.Minor == current.Minor &&
check.Revision == current.Revision &&
check.Extra != current.Extra))
{
if (check > current) {
hasUpdate = true;
onUpdateAvailable.emit(this,
uid, v,
Expand Down

0 comments on commit 0da7e52

Please sign in to comment.