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: fix incorrect modtime on some multipart transfers

Nick Craig-Wood57f5ad188ba7
diff --git a/fs/operations/multithread.go b/fs/operations/multithread.go
index 24725b355..582df8445 100644
--- a/fs/operations/multithread.go
+++ b/fs/operations/multithread.go
@@ -6,6 +6,7 @@ import (
"errors"
"fmt"
"io"
+ "time"
"github.com/rclone/rclone/fs"
"github.com/rclone/rclone/fs/accounting"
@@ -253,6 +254,9 @@ func multiThreadCopy(ctx context.Context, f fs.Fs, remote string, src fs.Object,
if err != nil {
return nil, fmt.Errorf("multi-thread copy: failed to read metadata from source object: %w", err)
}
+ if _, foundMeta := meta["mtime"]; !foundMeta {
+ meta.Set("mtime", src.ModTime(ctx).Format(time.RFC3339Nano))
+ }
err = do.SetMetadata(ctx, meta)
if err != nil {
return nil, fmt.Errorf("multi-thread copy: failed to set metadata: %w", err)