1
0
mirror of https://github.com/packwiz/packwiz.git synced 2025-04-27 16:46:30 +02:00

Don't write hash if retrieval failed

This commit is contained in:
comp500 2024-08-28 19:19:12 +01:00
parent 2d181f9f70
commit f1ea588c83

@ -50,7 +50,7 @@ var rehashCmd = &cobra.Command{
for dl := range session.StartDownloads() { for dl := range session.StartDownloads() {
if dl.Error != nil { if dl.Error != nil {
fmt.Printf("Error retrieving %s: %v\n", dl.Mod.Name, dl.Error) fmt.Printf("Error retrieving %s: %v\n", dl.Mod.Name, dl.Error)
} } else {
dl.Mod.Download.HashFormat = args[0] dl.Mod.Download.HashFormat = args[0]
dl.Mod.Download.Hash = dl.Hashes[args[0]] dl.Mod.Download.Hash = dl.Hashes[args[0]]
_, _, err := dl.Mod.Write() _, _, err := dl.Mod.Write()
@ -58,6 +58,7 @@ var rehashCmd = &cobra.Command{
fmt.Printf("Error saving mod %s: %v\n", dl.Mod.Name, err) fmt.Printf("Error saving mod %s: %v\n", dl.Mod.Name, err)
os.Exit(1) os.Exit(1)
} }
}
// TODO pass the hash to index instead of recomputing from scratch // TODO pass the hash to index instead of recomputing from scratch
} }