mirror of
https://github.com/packwiz/packwiz.git
synced 2025-04-19 13:06:30 +02:00
Remove special casing for casing differences, clarify error message
This commit is contained in:
parent
0656d794e1
commit
1a21eca3a2
@ -9,7 +9,6 @@ import (
|
|||||||
"path/filepath"
|
"path/filepath"
|
||||||
"strconv"
|
"strconv"
|
||||||
"fmt"
|
"fmt"
|
||||||
"strings"
|
|
||||||
|
|
||||||
"github.com/BurntSushi/toml"
|
"github.com/BurntSushi/toml"
|
||||||
)
|
)
|
||||||
@ -150,11 +149,8 @@ func (m Mod) DownloadFile(dest io.Writer) error {
|
|||||||
calculatedHash := hex.EncodeToString(h.Sum(nil))
|
calculatedHash := hex.EncodeToString(h.Sum(nil))
|
||||||
|
|
||||||
// Check if the hash of the downloaded file matches the expected hash.
|
// Check if the hash of the downloaded file matches the expected hash.
|
||||||
// Also check if the uppercase version of the expected hash matches.
|
if calculatedHash != m.Download.Hash {
|
||||||
if(strings.ToUpper(calculatedHash) != m.Download.Hash) {
|
return errors.New(fmt.Sprintf("Hash of downloaded file does no match with expected hash!\n download hash: %s\n expected hash: %s\n", calculatedHash, m.Download.Hash))
|
||||||
return errors.New(fmt.Sprintf("Hash of saved file %s only matches when uppercased. Consider changing this to prevent future issues.\n", m.GetFilePath()))
|
|
||||||
} else if calculatedHash != m.Download.Hash {
|
|
||||||
return errors.New(fmt.Sprintf("hash of saved file is invalid!\n .toml hash: %s\n download hash: %s\n", calculatedHash, m.Download.Hash))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
|
Loading…
x
Reference in New Issue
Block a user