From 95b7f8dd817dc1076219b0117baa0041ea3b737d Mon Sep 17 00:00:00 2001 From: Michael Eischer Date: Mon, 8 Mar 2021 20:23:57 +0100 Subject: [PATCH] s3: Fix sanity check The sanity check shouldn't replace the error message if there is already one. --- internal/backend/s3/s3.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/backend/s3/s3.go b/internal/backend/s3/s3.go index 8a8494623..044d39c5c 100644 --- a/internal/backend/s3/s3.go +++ b/internal/backend/s3/s3.go @@ -277,7 +277,7 @@ func (be *Backend) Save(ctx context.Context, h restic.Handle, rd restic.RewindRe debug.Log("%v -> %v bytes, err %#v: %v", objName, info.Size, err, err) // sanity check - if err != nil && info.Size != rd.Length() { + if err == nil && info.Size != rd.Length() { return errors.Errorf("wrote %d bytes instead of the expected %d bytes", info.Size, rd.Length()) }