[WIP] Fix minor bugs

This commit is contained in:
Vladimir Stoilov
2024-10-08 09:47:29 +03:00
parent a79be8b6a9
commit a8517cd65f
6 changed files with 21 additions and 17 deletions

View File

@@ -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()