"rsync for cloud storage" - Google Drive, S3, Dropbox, Backblaze B2, One Drive, Swift, Hubic, Wasabi, Google Cloud Storage, Azure Blob, Azure Files, Yandex Files
Go azure-blobazure-blob-storageazure-filesbackblaze-b2cloud-storagedropboxencryptionftpfuse-filesystemgogolanggoogle-cloud-storagegoogle-driveonedriveopenstack-swiftrclones3sftpsyncwebdav
fs/accounting: Fix "file already closed" on transfer retries
Nick Craig-Woodbfbddab46be5
diff --git a/fs/accounting/accounting.go b/fs/accounting/accounting.goindex 5d1229b29..50282ff26 100644--- a/fs/accounting/accounting.go+++ b/fs/accounting/accounting.go@@ -118,11 +118,15 @@ func (acc *Account) StopBuffering() {// async buffer (if any) and re-adding itfunc (acc *Account) UpdateReader(in io.ReadCloser) {acc.mu.Lock()- acc.StopBuffering()+ if acc.withBuf {+ acc.StopBuffering()+ }acc.in = inacc.close = inacc.origIn = in- acc.WithBuffer()+ if acc.withBuf {+ acc.WithBuffer()+ }acc.mu.Unlock()}diff --git a/fs/accounting/transfer.go b/fs/accounting/transfer.goindex 0d968661b..a1ab8d023 100644--- a/fs/accounting/transfer.go+++ b/fs/accounting/transfer.go@@ -117,6 +117,8 @@ func (tr *Transfer) Account(in io.ReadCloser) *Account {tr.mu.Lock()if tr.acc == nil {tr.acc = newAccountSizeName(tr.stats, in, tr.size, tr.remote)+ } else {+ tr.acc.UpdateReader(in)}tr.mu.Unlock()return tr.accdiff --git a/fs/operations/operations.go b/fs/operations/operations.goindex 8e5a9e707..dbc626dfc 100644--- a/fs/operations/operations.go+++ b/fs/operations/operations.go@@ -346,6 +346,7 @@ func Copy(ctx context.Context, f fs.Fs, dst fs.Object, remote string, src fs.Obj} else {actionTaken = "Copied (Rcat, new)"}+ // NB Rcat closes in0dst, err = Rcat(ctx, f, remote, in0, src.ModTime(ctx))newDst = dst} else {