refactor: some random improvements

This commit is contained in:
flow committed 2022-05-14 21:50:54 -03:00
1 parent 9899a0e098
commit 365cc198ba
2 files changed
+8 -5

No files matched your search

+4 -4
View File
@@ -504,16 +504,16 @@ void InstanceImportTask::processModrinth() {
QJsonObject hashes = Json::requireObject(obj, "hashes");
QString hash;
QCryptographicHash::Algorithm hashAlgorithm;
hash = Json::ensureString(hashes, "sha256");
hashAlgorithm = QCryptographicHash::Sha256;
hash = Json::ensureString(hashes, "sha1");
hashAlgorithm = QCryptographicHash::Sha1;
if (hash.isEmpty())
{
hash = Json::ensureString(hashes, "sha512");
hashAlgorithm = QCryptographicHash::Sha512;
if (hash.isEmpty())
{
hash = Json::ensureString(hashes, "sha1");
hashAlgorithm = QCryptographicHash::Sha1;
hash = Json::ensureString(hashes, "sha256");
hashAlgorithm = QCryptographicHash::Sha256;
if (hash.isEmpty())
{
throw JSONValidationError("No hash found for: " + file.path);