Handle uppercase hashes properly (case-fold compare or normalise to lowercase)

This commit is contained in:
comp500
2022-06-20 16:58:50 +01:00
parent b8d9727833
commit 0d8c1762a3
2 changed files with 6 additions and 6 deletions

View File

@@ -400,7 +400,7 @@ func (in Index) SaveFile(f IndexFile, dest io.Writer) error {
}
calculatedHash := h.HashToString(h.Sum(nil))
if calculatedHash != f.Hash && !viper.GetBool("no-internal-hashes") {
if !strings.EqualFold(calculatedHash, f.Hash) && !viper.GetBool("no-internal-hashes") {
return errors.New("hash of saved file is invalid")
}