mirror of
https://github.com/packwiz/packwiz.git
synced 2025-04-19 21:16:30 +02:00
Clarify hash mismatch error in mod.go and also check with uppercase hash
This commit is contained in:
parent
36d707e622
commit
ca20d88093
@ -8,6 +8,8 @@ import (
|
|||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
"fmt"
|
||||||
|
"strings"
|
||||||
|
|
||||||
"github.com/BurntSushi/toml"
|
"github.com/BurntSushi/toml"
|
||||||
)
|
)
|
||||||
@ -146,8 +148,8 @@ func (m Mod) DownloadFile(dest io.Writer) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
calculatedHash := hex.EncodeToString(h.Sum(nil))
|
calculatedHash := hex.EncodeToString(h.Sum(nil))
|
||||||
if calculatedHash != m.Download.Hash {
|
if calculatedHash != m.Download.Hash && strings.ToUpper(calculatedHash) != m.Download.Hash {
|
||||||
return errors.New("hash of saved file is invalid")
|
return errors.New(fmt.Sprintf("hash of saved file is invalid!\n .toml hash: %s\n download hash: %s", calculatedHash, m.Download.Hash))
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user