1
0
mirror of https://github.com/rclone/rclone.git synced 2026-01-03 17:13:18 +00:00

operations: fix OpenOptions ignored in copy if operation was a multiThreadCopy

This commit is contained in:
Vitor Gomes
2023-10-10 16:31:21 +02:00
committed by Nick Craig-Wood
parent f6b9fdf7c6
commit cc036884d4
2 changed files with 14 additions and 12 deletions

View File

@@ -418,8 +418,17 @@ func Copy(ctx context.Context, f fs.Fs, dst fs.Object, remote string, src fs.Obj
removeFailedPartialCopy(ctx, f, remotePartial)
})
}
uploadOptions := []fs.OpenOption{hashOption}
for _, option := range ci.UploadHeaders {
uploadOptions = append(uploadOptions, option)
}
if ci.MetadataSet != nil {
uploadOptions = append(uploadOptions, fs.MetadataOption(ci.MetadataSet))
}
if doMultiThreadCopy(ctx, f, src) {
dst, err = multiThreadCopy(ctx, f, remotePartial, src, ci.MultiThreadStreams, tr)
dst, err = multiThreadCopy(ctx, f, remotePartial, src, ci.MultiThreadStreams, tr, uploadOptions...)
if err == nil {
newDst = dst
}
@@ -463,17 +472,10 @@ func Copy(ctx context.Context, f fs.Fs, dst fs.Object, remote string, src fs.Obj
if src.Remote() != remotePartial {
wrappedSrc = fs.NewOverrideRemote(src, remotePartial)
}
options := []fs.OpenOption{hashOption}
for _, option := range ci.UploadHeaders {
options = append(options, option)
}
if ci.MetadataSet != nil {
options = append(options, fs.MetadataOption(ci.MetadataSet))
}
if doUpdate && inplace {
err = dst.Update(ctx, in, wrappedSrc, options...)
err = dst.Update(ctx, in, wrappedSrc, uploadOptions...)
} else {
dst, err = f.Put(ctx, in, wrappedSrc, options...)
dst, err = f.Put(ctx, in, wrappedSrc, uploadOptions...)
}
if doUpdate {
actionTaken = "Copied (replaced existing)"