Skip to content

"rsync for cloud storage" - Google Drive, S3, Dropbox, Backblaze B2, One Drive, Swift, Hubic, Wasabi, Google Cloud Storage, Azure Blob, Azure Files, Yandex Files

vfs: Fix over downloading with --vfs-cache-mode full and --buffer-size 0

Nick Craig-Wood8301a724530a
diff --git a/vfs/vfscache/downloaders/downloaders.go b/vfs/vfscache/downloaders/downloaders.go
index 8347b0cd1..5c8967407 100644
--- a/vfs/vfscache/downloaders/downloaders.go
+++ b/vfs/vfscache/downloaders/downloaders.go
@@ -460,6 +460,14 @@ func (dl *downloader) Write(p []byte) (n int, err error) {
fs.Debugf(dl.dls.src, "stopping download thread as it has skipped %d bytes", dl.skipped)
dl._stop()
}
+
+ // If running without a async buffer then stop now as
+ // StopBuffering has no effect if the Account wasn't buffered
+ // so we need to stop manually now rather than wait for the
+ // AsyncReader to stop.
+ if dl.stop && !dl.in.HasBuffer() {
+ err = asyncreader.ErrorStreamAbandoned
+ }
return n, err
}