mirror of
https://github.com/rclone/rclone.git
synced 2025-02-22 07:21:55 +08:00
operations: fix incorrect modtime on some multipart transfers
In this commit 6a0a54ab97a5aaba operations: fix missing metadata for multipart transfers to local disk We broke the setting of modification times when doing multipart transfers from a backend which didn't support metadata to a backend which did support metadata. This was fixed by setting the "mtime" in the metadata if it was missing.
This commit is contained in:
parent
76798d5bb1
commit
57f5ad188b
@ -6,6 +6,7 @@ import (
|
|||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
|
"time"
|
||||||
|
|
||||||
"github.com/rclone/rclone/fs"
|
"github.com/rclone/rclone/fs"
|
||||||
"github.com/rclone/rclone/fs/accounting"
|
"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 {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("multi-thread copy: failed to read metadata from source object: %w", err)
|
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)
|
err = do.SetMetadata(ctx, meta)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("multi-thread copy: failed to set metadata: %w", err)
|
return nil, fmt.Errorf("multi-thread copy: failed to set metadata: %w", err)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user