diff --git a/lib/s3/right_s3.rb b/lib/s3/right_s3.rb index f6d275a..79502a5 100644 --- a/lib/s3/right_s3.rb +++ b/lib/s3/right_s3.rb @@ -541,11 +541,11 @@ def put(data=nil, perms=nil, headers={}, &blck) # key.data = upload_data # key.put_multipart(:part_size => 5*1024*1024) #=> true # - def put_multipart(data=nil, perms=nil, headers={}, part_size=nil) + def put_multipart(data=nil, perms=nil, headers={}, part_size=nil, &block) headers['x-amz-acl'] = perms if perms @data = data || @data meta = self.class.add_meta_prefix(@meta_headers) - @bucket.s3.interface.store_object_multipart({:bucket => @bucket.name, :key => @name, :data => @data, :headers => meta.merge(headers), :part_size => part_size}) + @bucket.s3.interface.store_object_multipart({:bucket => @bucket.name, :key => @name, :data => @data, :headers => meta.merge(headers), :part_size => part_size}, &block) end # Rename an object. Returns new object name. diff --git a/lib/s3/right_s3_interface.rb b/lib/s3/right_s3_interface.rb index 4f21511..3d2471d 100644 --- a/lib/s3/right_s3_interface.rb +++ b/lib/s3/right_s3_interface.rb @@ -600,6 +600,7 @@ def store_object_multipart(params) send_part_hash = generate_rest_request('PUT', params[:headers].merge({ :url=>"#{params[:bucket]}/#{CGI::escape params[:key]}?partNumber=#{index}&uploadId=#{upload_id}", :data=>part_data } )) send_part_resp = request_info(send_part_hash, S3HttpResponseHeadParser.new) part_etags << {:part_num => index, :etag => send_part_resp['etag']} + yield(part_data) if block_given? index += 1 break # successful, can move to next part rescue AwsError => e