operations: remove partials when the copy fails

Before this change we were only removing partials when it was
corrupted rather than when the copy just failed.
This commit is contained in:
Nick Craig-Wood 2023-06-21 19:35:17 +01:00
parent 4f8dab8bce
commit da955e5d4f
1 changed files with 3 additions and 0 deletions

View File

@ -529,6 +529,9 @@ func Copy(ctx context.Context, f fs.Fs, dst fs.Object, remote string, src fs.Obj
if err != nil {
err = fs.CountError(err)
fs.Errorf(src, "Failed to copy: %v", err)
if !inplace {
removeFailedPartialCopy(ctx, f, remotePartial)
}
return newDst, err
}