"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/chunkedreader: fix spurious errors when a parallel stream is closed early
Nick Craig-Wooded9eec0f20d3
diff --git a/fs/chunkedreader/parallel.go b/fs/chunkedreader/parallel.goindex 15d0da4a1..a76d8915c 100644--- a/fs/chunkedreader/parallel.go+++ b/fs/chunkedreader/parallel.go@@ -2,11 +2,13 @@ package chunkedreaderimport ("context"+ "errors""fmt""io""sync""github.com/rclone/rclone/fs"+ "github.com/rclone/rclone/fs/asyncreader""github.com/rclone/rclone/fs/hash""github.com/rclone/rclone/fs/log""github.com/rclone/rclone/fs/operations"@@ -136,6 +138,14 @@ func (s *stream) close() (err error) {if s.rc != nil {orErr(&err, s.rc.Close())}+ // close cancels the stream's context above, so a cancellation error+ // just means the stream was intentionally abandoned. Report that as+ // asyncreader.ErrorStreamAbandoned - the same signal the sequential+ // reader uses - so callers (e.g. the VFS cache downloader) treat it as+ // a benign teardown rather than a read failure.+ if errors.Is(err, context.Canceled) {+ return asyncreader.ErrorStreamAbandoned+ }if err != nil && err != io.EOF {return fmt.Errorf("parallel chunked reader: failed to read stream at %d size %d: %w", s.offset, s.size, err)}