mirror of
https://github.com/rclone/rclone.git
synced 2025-12-12 06:24:14 +01:00
gcs: fix --gcs-storage-class to work with server side copy for objects
This commit is contained in:
@@ -1134,7 +1134,15 @@ func (f *Fs) Copy(ctx context.Context, src fs.Object, remote string) (fs.Object,
|
|||||||
remote: remote,
|
remote: remote,
|
||||||
}
|
}
|
||||||
|
|
||||||
rewriteRequest := f.svc.Objects.Rewrite(srcBucket, srcPath, dstBucket, dstPath, nil)
|
// Set the storage class for the destination object if configured
|
||||||
|
var dstObject *storage.Object
|
||||||
|
if f.opt.StorageClass != "" {
|
||||||
|
dstObject = &storage.Object{
|
||||||
|
StorageClass: f.opt.StorageClass,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
rewriteRequest := f.svc.Objects.Rewrite(srcBucket, srcPath, dstBucket, dstPath, dstObject)
|
||||||
if !f.opt.BucketPolicyOnly {
|
if !f.opt.BucketPolicyOnly {
|
||||||
rewriteRequest.DestinationPredefinedAcl(f.opt.ObjectACL)
|
rewriteRequest.DestinationPredefinedAcl(f.opt.ObjectACL)
|
||||||
}
|
}
|
||||||
@@ -1422,6 +1430,10 @@ func (o *Object) Update(ctx context.Context, in io.Reader, src fs.ObjectInfo, op
|
|||||||
ContentType: fs.MimeType(ctx, src),
|
ContentType: fs.MimeType(ctx, src),
|
||||||
Metadata: metadataFromModTime(modTime),
|
Metadata: metadataFromModTime(modTime),
|
||||||
}
|
}
|
||||||
|
// Set the storage class from config if configured
|
||||||
|
if o.fs.opt.StorageClass != "" {
|
||||||
|
object.StorageClass = o.fs.opt.StorageClass
|
||||||
|
}
|
||||||
// Apply upload options
|
// Apply upload options
|
||||||
for _, option := range options {
|
for _, option := range options {
|
||||||
key, value := option.Header()
|
key, value := option.Header()
|
||||||
|
|||||||
Reference in New Issue
Block a user