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

View File

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