lib/io_streams/paths/s3.rb in iostreams-1.0.0.beta3 vs lib/io_streams/paths/s3.rb in iostreams-1.0.0.beta4
- old
+ new
@@ -132,10 +132,13 @@
@bucket_name = uri.host
key = uri.path.sub(%r{\A/}, '')
@client = client || ::Aws::S3::Client.new
@options = args
+
+ URI.decode_www_form(uri.query).each { |key, value| @options[key] = value } if uri.query
+
super(key)
end
def to_s
::File.join("s3://", bucket_name, path)
@@ -191,10 +194,10 @@
def reader(&block)
# Since S3 download only supports a push stream, write it to a tempfile first.
Utils.temp_file_name("iostreams_s3") do |file_name|
read_file(file_name)
- ::File.open(file_name, 'rb') { |io| io.read }
+ ::File.open(file_name, 'rb', &block)
end
end
# Shortcut method if caller has a filename already with no other streams applied:
def read_file(file_name)