backend/b2: correctly close file if too short

This commit is contained in:
Michael Eischer
2026-06-14 16:38:21 +02:00
parent 6b88b072e0
commit 5c8c048c1a
+1
View File
@@ -238,6 +238,7 @@ func (be *b2Backend) Save(ctx context.Context, h backend.Handle, rd backend.Rewi
// sanity check
if n != rd.Length() {
_ = w.Close()
return errors.Errorf("wrote %d bytes instead of the expected %d bytes", n, rd.Length())
}
return errors.Wrap(w.Close(), "Close")