From 12cd3226432a068f5be584880a8c68ee5991a7e0 Mon Sep 17 00:00:00 2001 From: albertony <12441419+albertony@users.noreply.github.com> Date: Tue, 23 Mar 2021 18:36:51 +0100 Subject: [PATCH] crypt: log hash ok on upload --- backend/crypt/crypt.go | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/backend/crypt/crypt.go b/backend/crypt/crypt.go index aa07b7a68..6d186d13d 100644 --- a/backend/crypt/crypt.go +++ b/backend/crypt/crypt.go @@ -404,13 +404,16 @@ func (f *Fs) put(ctx context.Context, in io.Reader, src fs.ObjectInfo, options [ if err != nil { return nil, errors.Wrap(err, "failed to read destination hash") } - if srcHash != "" && dstHash != "" && srcHash != dstHash { - // remove object - err = o.Remove(ctx) - if err != nil { - fs.Errorf(o, "Failed to remove corrupted object: %v", err) + if srcHash != "" && dstHash != "" { + if srcHash != dstHash { + // remove object + err = o.Remove(ctx) + if err != nil { + fs.Errorf(o, "Failed to remove corrupted object: %v", err) + } + return nil, errors.Errorf("corrupted on transfer: %v crypted hash differ %q vs %q", ht, srcHash, dstHash) } - return nil, errors.Errorf("corrupted on transfer: %v crypted hash differ %q vs %q", ht, srcHash, dstHash) + fs.Debugf(src, "%v = %s OK", ht, srcHash) } }