mirror of
https://github.com/packwiz/packwiz.git
synced 2025-04-19 13:06:30 +02:00
Change url add command to use sha256 (fixes #156)
This commit is contained in:
parent
4fb1f1b59d
commit
6ab8235086
@ -57,9 +57,9 @@ var installCmd = &cobra.Command{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
hash, err := getSha1(args[1])
|
hash, err := getHash(args[1])
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Println("Failed to retrieve SHA1 hash for file", err)
|
fmt.Println("Failed to retrieve SHA256 hash for file", err)
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -75,7 +75,7 @@ var installCmd = &cobra.Command{
|
|||||||
FileName: filename,
|
FileName: filename,
|
||||||
Download: core.ModDownload{
|
Download: core.ModDownload{
|
||||||
URL: args[1],
|
URL: args[1],
|
||||||
HashFormat: "sha1",
|
HashFormat: "sha256",
|
||||||
Hash: hash,
|
Hash: hash,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
@ -123,9 +123,8 @@ var installCmd = &cobra.Command{
|
|||||||
fmt.Printf("Successfully added %s (%s) from: %s\n", args[0], destPath, args[1])
|
fmt.Printf("Successfully added %s (%s) from: %s\n", args[0], destPath, args[1])
|
||||||
}}
|
}}
|
||||||
|
|
||||||
func getSha1(url string) (string, error) {
|
func getHash(url string) (string, error) {
|
||||||
// TODO: hook up to existing cache system? might not be that useful
|
mainHasher, err := core.GetHashImpl("sha256")
|
||||||
mainHasher, err := core.GetHashImpl("sha1")
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user