mirror of
https://github.com/rclone/rclone.git
synced 2024-11-29 03:48:27 +08:00
s3: use configured server-side-encryption and storace class options when calling CopyObject() - fixes #2610
This commit is contained in:
parent
06ae4258be
commit
7826e39fcf
|
@ -1240,6 +1240,15 @@ func (f *Fs) Copy(src fs.Object, remote string) (fs.Object, error) {
|
||||||
CopySource: &source,
|
CopySource: &source,
|
||||||
MetadataDirective: aws.String(s3.MetadataDirectiveCopy),
|
MetadataDirective: aws.String(s3.MetadataDirectiveCopy),
|
||||||
}
|
}
|
||||||
|
if f.opt.ServerSideEncryption != "" {
|
||||||
|
req.ServerSideEncryption = &f.opt.ServerSideEncryption
|
||||||
|
}
|
||||||
|
if f.opt.SSEKMSKeyID != "" {
|
||||||
|
req.SSEKMSKeyId = &f.opt.SSEKMSKeyID
|
||||||
|
}
|
||||||
|
if f.opt.StorageClass != "" {
|
||||||
|
req.StorageClass = &f.opt.StorageClass
|
||||||
|
}
|
||||||
err = f.pacer.Call(func() (bool, error) {
|
err = f.pacer.Call(func() (bool, error) {
|
||||||
_, err = f.c.CopyObject(&req)
|
_, err = f.c.CopyObject(&req)
|
||||||
return shouldRetry(err)
|
return shouldRetry(err)
|
||||||
|
@ -1409,6 +1418,15 @@ func (o *Object) SetModTime(modTime time.Time) error {
|
||||||
Metadata: o.meta,
|
Metadata: o.meta,
|
||||||
MetadataDirective: &directive,
|
MetadataDirective: &directive,
|
||||||
}
|
}
|
||||||
|
if o.fs.opt.ServerSideEncryption != "" {
|
||||||
|
req.ServerSideEncryption = &o.fs.opt.ServerSideEncryption
|
||||||
|
}
|
||||||
|
if o.fs.opt.SSEKMSKeyID != "" {
|
||||||
|
req.SSEKMSKeyId = &o.fs.opt.SSEKMSKeyID
|
||||||
|
}
|
||||||
|
if o.fs.opt.StorageClass != "" {
|
||||||
|
req.StorageClass = &o.fs.opt.StorageClass
|
||||||
|
}
|
||||||
err = o.fs.pacer.Call(func() (bool, error) {
|
err = o.fs.pacer.Call(func() (bool, error) {
|
||||||
_, err := o.fs.c.CopyObject(&req)
|
_, err := o.fs.c.CopyObject(&req)
|
||||||
return shouldRetry(err)
|
return shouldRetry(err)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user