diff options
author | flow <thiagodonato300@gmail.com> | 2022-05-06 12:42:01 -0300 |
---|---|---|
committer | flow <flowlnlnln@gmail.com> | 2022-05-23 14:43:31 -0300 |
commit | 59d628208b403bfb2442291cbca139cbdfcd325f (patch) | |
tree | 8d51c3ee5817520d37e8acc3d18134906285d8a3 /launcher/modplatform/modrinth | |
parent | 5c5699bba5ed2a5befb7c3f8d9fbcd679a8698ab (diff) | |
download | PrismLauncher-59d628208b403bfb2442291cbca139cbdfcd325f.tar.gz PrismLauncher-59d628208b403bfb2442291cbca139cbdfcd325f.tar.bz2 PrismLauncher-59d628208b403bfb2442291cbca139cbdfcd325f.zip |
feat: allow trying to use multiple hash types
Diffstat (limited to 'launcher/modplatform/modrinth')
-rw-r--r-- | launcher/modplatform/modrinth/ModrinthPackIndex.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/launcher/modplatform/modrinth/ModrinthPackIndex.cpp b/launcher/modplatform/modrinth/ModrinthPackIndex.cpp index aa798381..30693a82 100644 --- a/launcher/modplatform/modrinth/ModrinthPackIndex.cpp +++ b/launcher/modplatform/modrinth/ModrinthPackIndex.cpp @@ -116,8 +116,14 @@ auto Modrinth::loadIndexedPackVersion(QJsonObject &obj) -> ModPlatform::IndexedV file.downloadUrl = Json::requireString(parent, "url"); file.fileName = Json::requireString(parent, "filename"); auto hash_list = Json::requireObject(parent, "hashes"); - if (hash_list.contains(ProviderCaps.hashType(ModPlatform::Provider::MODRINTH))) - file.hash = Json::requireString(hash_list, ProviderCaps.hashType(ModPlatform::Provider::MODRINTH)); + auto hash_types = ProviderCaps.hashType(ModPlatform::Provider::MODRINTH); + for (auto& hash_type : hash_types) { + if (hash_list.contains(hash_type)) { + file.hash = Json::requireString(hash_list, hash_type); + file.hash_type = hash_type; + break; + } + } return file; } |