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

local: fix copying from Windows Volume Shadows

Nick Craig-Wood5b0f9dc4e335
diff --git a/backend/local/local.go b/backend/local/local.go
index d1a613f5f..e10980a3c 100644
--- a/backend/local/local.go
+++ b/backend/local/local.go
@@ -146,6 +146,11 @@ time we:
- Only checksum the size that stat gave
- Don't update the stat info for the file
+**NB** do not use this flag on a Windows Volume Shadow (VSS). For some
+unknown reason, files in a VSS sometimes show different sizes from the
+directory listing (where the initial stat value comes from on Windows)
+and when stat is called on them directly. Other copy tools always use
+the direct stat value and setting this flag will disable that.
`,
Default: false,
Advanced: true,
@@ -1123,6 +1128,12 @@ func (o *Object) Open(ctx context.Context, options ...fs.OpenOption) (in io.Read
}
}
+ // Update the file info before we start reading
+ err = o.lstat()
+ if err != nil {
+ return nil, err
+ }
+
// If not checking updated then limit to current size. This means if
// file is being extended, readers will read a o.Size() bytes rather
// than the new size making for a consistent upload.