Sort modpack versions properly (#5170)

This commit is contained in:
Rachel Powers 2026-03-20 23:00:39 +00:00 committed by GitHub
commit 26a2b35a3b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -2,6 +2,7 @@
#include "Application.h"
#include "Json.h"
#include "Version.h"
#include "net/NetJob.h"
#include "modplatform/ModIndex.h"
@ -116,8 +117,7 @@ Task::Ptr ResourceAPI::getProjectVersions(VersionSearchArgs&& args, Callback<QVe
}
auto orderSortPredicate = [](const ModPlatform::IndexedVersion& a, const ModPlatform::IndexedVersion& b) -> bool {
// dates are in RFC 3339 format
return a.date > b.date;
return Version(a.version) > Version(b.version);
};
std::sort(unsortedVersions.begin(), unsortedVersions.end(), orderSortPredicate);
} catch (const JSONValidationError& e) {