mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
[s3] files.all now defaults to loading until pages are no longer truncated
This commit is contained in:
parent
65e4da9e5d
commit
f77fdc9a7e
3 changed files with 7 additions and 3 deletions
|
@ -42,10 +42,12 @@ module Fog
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
directory.files.merge_attributes(options)
|
directory.files.merge_attributes(options)
|
||||||
directory.files.instance_variable_set(:@loaded, true)
|
files = data['Contents']
|
||||||
data['Contents'].each do |file|
|
while data['IsTruncated']
|
||||||
directory.files << directory.files.new(file)
|
data = connection.get_bucket(name, options.merge!('marker' => files.last['Key'])).body
|
||||||
|
files.concat(data['Contents'])
|
||||||
end
|
end
|
||||||
|
directory.files.load(files)
|
||||||
directory
|
directory
|
||||||
rescue Excon::Errors::NotFound
|
rescue Excon::Errors::NotFound
|
||||||
nil
|
nil
|
||||||
|
|
|
@ -39,6 +39,7 @@ module Fog
|
||||||
'max-keys' => @max_keys,
|
'max-keys' => @max_keys,
|
||||||
'prefix' => @prefix
|
'prefix' => @prefix
|
||||||
}.merge!(options)
|
}.merge!(options)
|
||||||
|
options = options.reject {|key,value| value.nil? || value.empty?}
|
||||||
data = connection.get_object(directory.name, key, options, &block)
|
data = connection.get_object(directory.name, key, options, &block)
|
||||||
file_data = {
|
file_data = {
|
||||||
:body => data.body,
|
:body => data.body,
|
||||||
|
|
|
@ -38,6 +38,7 @@ module Fog
|
||||||
unless bucket_name
|
unless bucket_name
|
||||||
raise ArgumentError.new('bucket_name is required')
|
raise ArgumentError.new('bucket_name is required')
|
||||||
end
|
end
|
||||||
|
options.reject! {|key, value| !['prefix', 'marker', 'max-keys', 'delimiter'].include?(key)}
|
||||||
query = ''
|
query = ''
|
||||||
for key, value in options
|
for key, value in options
|
||||||
query << "#{key}=#{CGI.escape(value.to_s).gsub(/\+/, '%20')};"
|
query << "#{key}=#{CGI.escape(value.to_s).gsub(/\+/, '%20')};"
|
||||||
|
|
Loading…
Add table
Reference in a new issue