Skip to content

Commit

Permalink
Merge pull request #586 from monstermunchkin/fixes/downloads
Browse files Browse the repository at this point in the history
sources: Fix downloads with multiple hashes
  • Loading branch information
stgraber authored Nov 25, 2021
2 parents 83a271f + 2aa9a11 commit e350b29
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions sources/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -144,23 +144,23 @@ func (s *common) DownloadHash(def shared.DefinitionImage, file, checksum string,
}, 3)
} else {
// Check all file hashes in case multiple have been provided.
for _, h := range hashes {
if hashFunc != nil {
hashFunc.Reset()
}
err = shared.Retry(func() error {
for _, h := range hashes {
if hashFunc != nil {
hashFunc.Reset()
}

err = shared.Retry(func() error {
_, err = lxd.DownloadFileHash(s.ctx, &client, "", progress, nil, imagePath, file, h, hashFunc, image)
if err != nil {
os.Remove(imagePath)
if err == nil {
break
}

return err
}, 3)
if err == nil {
break
}
}
if err != nil {
os.Remove(imagePath)
}

return err
}, 3)
}
if err != nil {
return "", err
Expand Down

0 comments on commit e350b29

Please sign in to comment.