Merge pull request #3327 from MichaelEischer/fix-s3-sanity-check

s3: Fix sanity check
This commit is contained in:
Alexander Neumann 2021-03-11 13:13:46 +01:00 committed by GitHub
commit 88a23521dd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

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