From 958527231132ac9cfca66d7f323408484b0d8b45 Mon Sep 17 00:00:00 2001 From: comp500 Date: Mon, 14 Feb 2022 16:53:34 +0000 Subject: [PATCH] Reorder preferred hash list --- modrinth/modrinth.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/modrinth/modrinth.go b/modrinth/modrinth.go index ae0e6c7..69a4d4a 100644 --- a/modrinth/modrinth.go +++ b/modrinth/modrinth.go @@ -317,7 +317,11 @@ func shouldDownloadOnSide(side string) bool { func (v VersionFile) getBestHash() (string, string) { //try preferred hashes first - val, exists := v.Hashes["sha256"] + val, exists := v.Hashes["sha512"] + if exists { + return "sha512", val + } + val, exists = v.Hashes["sha256"] if exists { return "sha256", val } @@ -325,10 +329,6 @@ func (v VersionFile) getBestHash() (string, string) { if exists { return "murmur2", val } - val, exists = v.Hashes["sha512"] - if exists { - return "sha512", val - } //none of the preferred hashes are present, just get the first one for key, val := range v.Hashes {