lib/aws/s3/s3_object.rb in aws-sdk-1.2.3 vs lib/aws/s3/s3_object.rb in aws-sdk-1.2.4
- old
+ new
@@ -408,17 +408,16 @@
add_configured_write_options(options)
upload = multipart_uploads.create(options)
if block_given?
- result = nil
begin
yield(upload)
- ensure
- result = upload.close
+ upload.close
+ rescue
+ upload.abort
end
- result
else
upload
end
end
@@ -486,10 +485,14 @@
# encryption algorithm with 256 bit keys. By default, this
# option uses the value of the +:s3_server_side_encryption+
# option in the current configuration; for more information,
# see {AWS.config}.
#
+ # @option options :cache_control [String] Can be used to specify
+ # caching behavior. See
+ # http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.9
+ #
# @return [nil]
def copy_from source, options = {}
copy_opts = { :bucket_name => bucket.name, :key => key }
@@ -522,10 +525,12 @@
copy_opts[:acl] = options[:acl] if options[:acl]
copy_opts[:version_id] = options[:version_id] if options[:version_id]
copy_opts[:server_side_encryption] =
options[:server_side_encryption] if
options.key?(:server_side_encryption)
+ copy_opts[:cache_control] = options[:cache_control] if
+ options[:cache_control]
add_configured_write_options(copy_opts)
if options[:reduced_redundancy]
copy_opts[:storage_class] = 'REDUCED_REDUNDANCY'
else
@@ -639,9 +644,10 @@
# @option options [String] :if_none_match If specified, the
# method will raise <tt>AWS::S3::Errors::NotModified</tt> if
# the object ETag matches the provided value.
#
# @option options [Range] :range A byte range to read data from
+ #
def read(options = {}, &blk)
options[:bucket_name] = bucket.name
options[:key] = key
client.get_object(options).data
end