[WIP] Fix minor bugs
This commit is contained in:
@@ -120,9 +120,12 @@ func checkIfFileIsValid(filename string, artifact Artifact) (bool, error) {
|
||||
defer func() { _ = file.Close() }()
|
||||
|
||||
providedHash, err := hex.DecodeString(artifact.SHA256)
|
||||
if err != nil || len(providedHash) != sha256.Size {
|
||||
if err != nil {
|
||||
return false, fmt.Errorf("invalid provided hash %s: %w", artifact.SHA256, err)
|
||||
}
|
||||
if len(providedHash) != sha256.Size {
|
||||
return false, fmt.Errorf("invalid hash length for %s", artifact.SHA256)
|
||||
}
|
||||
|
||||
// Calculate hash of the file
|
||||
fileHash := sha256.New()
|
||||
|
||||
@@ -181,7 +181,7 @@ func (d *Downloader) downloadAndVerify(ctx context.Context) error {
|
||||
// Make sure we have the bundle file parsed.
|
||||
err := d.parseBundle()
|
||||
if err != nil {
|
||||
log.Errorf("updates: invalid update bundle file: %s", err)
|
||||
return fmt.Errorf("invalid update bundle file: %w", err)
|
||||
}
|
||||
|
||||
// Make sure dir exists
|
||||
|
||||
Reference in New Issue
Block a user