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

operations: ignore negative sizes when calculating total (#3135)

Garry McNulty34f03ce5900d
diff --git a/fs/operations/operations.go b/fs/operations/operations.go
index 5d15e80c6..b91e168c2 100644
--- a/fs/operations/operations.go
+++ b/fs/operations/operations.go
@@ -960,7 +960,10 @@ func HashLister(ht hash.Type, f fs.Fs, w io.Writer) error {
func Count(f fs.Fs) (objects int64, size int64, err error) {
err = ListFn(f, func(o fs.Object) {
atomic.AddInt64(&objects, 1)
- atomic.AddInt64(&size, o.Size())
+ objectSize := o.Size()
+ if objectSize > 0 {
+ atomic.AddInt64(&size, objectSize)
+ }
})
return
}