lib/aws/s3/s3_object.rb in aws-sdk-1.2.0 vs lib/aws/s3/s3_object.rb in aws-sdk-1.2.1

- old
+ new

@@ -457,10 +457,14 @@ # # @option options [Hash] :metadata A hash of metadata to save # with the copied object. Each name, value pair must conform # to US-ASCII. When blank, the sources metadata is copied. # + # @option options [String] :content_type The content type of + # the copied object. Defaults to the source object's content + # type. + # # @option options [Boolean] :reduced_redundancy (false) If true the # object is stored with reduced redundancy in S3 for a lower cost. # # @option options [String] :version_id (nil) Causes the copy to # read a specific version of the source object. @@ -501,14 +505,19 @@ when options[:bucket_name] then "#{options[:bucket_name]}/#{source}" else "#{self.bucket.name}/#{source}" end end + copy_opts[:metadata_directive] = 'COPY' + if options[:metadata] copy_opts[:metadata] = options[:metadata] copy_opts[:metadata_directive] = 'REPLACE' - else - copy_opts[:metadata_directive] = 'COPY' + end + + if options[:content_type] + copy_opts[:content_type] = options[:content_type] + copy_opts[:metadata_directive] = "REPLACE" end copy_opts[:acl] = options[:acl] if options[:acl] copy_opts[:version_id] = options[:version_id] if options[:version_id] copy_opts[:server_side_encryption] =