mirror of
https://github.com/rclone/rclone
synced 2025-01-13 17:06:24 +01:00
local: support metadata setting and mapping on server side Move
Before this change the backend would not run the metadata mapper and it would ignore metadata set when doing server side moves.
This commit is contained in:
parent
24b4148b5e
commit
6e85a39e99
@ -832,6 +832,12 @@ func (f *Fs) Move(ctx context.Context, src fs.Object, remote string) (fs.Object,
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// Fetch metadata if --metadata is in use
|
||||
meta, err := fs.GetMetadataOptions(ctx, f, src, fs.MetadataAsOpenOptions(ctx))
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("move: failed to read metadata: %w", err)
|
||||
}
|
||||
|
||||
// Do the move
|
||||
err = os.Rename(srcObj.path, dstObj.path)
|
||||
if os.IsNotExist(err) {
|
||||
@ -847,6 +853,12 @@ func (f *Fs) Move(ctx context.Context, src fs.Object, remote string) (fs.Object,
|
||||
return nil, fs.ErrorCantMove
|
||||
}
|
||||
|
||||
// Set metadata if --metadata is in use
|
||||
err = dstObj.writeMetadata(meta)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("move: failed to set metadata: %w", err)
|
||||
}
|
||||
|
||||
// Update the info
|
||||
err = dstObj.lstat()
|
||||
if err != nil {
|
||||
|
Loading…
Reference in New Issue
Block a user