From e6af4d1a5ce976fb74c70760675f7f31767f734d Mon Sep 17 00:00:00 2001 From: KatolaZ Date: Sun, 23 Jul 2017 10:07:33 +0200 Subject: hash check is working --- exec.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/exec.go b/exec.go index 52e358c..dc7563c 100644 --- a/exec.go +++ b/exec.go @@ -41,8 +41,10 @@ func check_hash(file, hash string) error { return err } hash_bytes := sha256.Sum256(data) - computed_hash := string(hash_bytes[:sha256.Size]) - if string(computed_hash) == hash { + computed_hash := fmt.Sprintf("%x", string(hash_bytes[:sha256.Size])) + debug.log("[check_hash] configured hash string: %s\n", hash) + debug.log("[check_hash] computed hash string: %s\n", computed_hash) + if computed_hash == hash { return nil } else { return fmt.Errorf("WARNING!!! HASH MISMATCH FOR %s", file) @@ -74,6 +76,7 @@ func exec_tag(tag *SCORSHtag_cfg, args []string, env []string) []error { // if the hash does not match, abort the command if err != nil { log.Printf("[tag: %s] %s -- aborting command\n", tag.Name, err) + ret = append(ret, err) continue } else { // finally, the command can be executed -- cgit v1.2.3