2
2
mirror of https://github.com/octoleo/restic.git synced 2024-12-26 20:30:19 +00:00

s3: Fix sanity check

The sanity check shouldn't replace the error message if there is already
one.
This commit is contained in:
Michael Eischer 2021-03-08 20:23:57 +01:00
parent d686fa25de
commit 2a9f0f19b6

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