lib/backup/file_item/cloud.rb in palobr-0.1.0 vs lib/backup/file_item/cloud.rb in palobr-0.1.0.1
- old
+ new
@@ -39,14 +39,17 @@
def dir(path, mask = "*")
path = delete_slashes(path)
mask = mask.gsub('.', '\.').gsub('*', '[^\/]')
- try_to_work_with_cloud do
- files = @directory.files.map &:key
- end
-
+ files = []
+
+ files = @directory.files.all(
+ :prefix => path,
+ :max_keys => 30_000 #TODO: Fix or use it?
+ ).map &:key
+
files.map do |item|
match = item.match(/^#{path}\/([^\/]+#{mask}).*$/)
match[1] if match
end.compact.uniq
end
@@ -66,10 +69,9 @@
try_to_connect_with_cloud
yield
end
end
-
def try_to_connect_with_cloud
begin
@connection = ::Fog::Storage.new(
:provider => 'AWS',
\ No newline at end of file