FIX: Do not show backups stored in subfolder of bucket

This commit is contained in:
Gerhard Schlager
2019-01-24 21:58:36 +01:00
parent 7e9da812ea
commit 45b056b615
3 changed files with 18 additions and 2 deletions

View File

@@ -59,7 +59,7 @@ module BackupRestore
objects = []
@s3_helper.list.each do |obj|
if obj.key.match?(/\.t?gz$/i)
if obj.key.match?(file_regex)
objects << create_file_from_object(obj)
end
end
@@ -106,6 +106,19 @@ module BackupRestore
end
end
def file_regex
@file_regex ||= begin
path = @s3_helper.s3_bucket_folder_path || ""
if path.present?
path = "#{path}/" unless path.end_with?("/")
path = Regexp.quote(path)
end
/^#{path}[^\/]*\.t?gz$/i
end
end
def free_bytes
nil
end