mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
AWS | storage: make directory.persisted? tell the truth
directory.persisted? was relying on the directory having a key which is almost always true and not related to storage anyways.
This commit is contained in:
parent
416f0d1cb3
commit
62f07402b3
2 changed files with 8 additions and 1 deletions
|
@ -22,7 +22,7 @@ module Fog
|
|||
:prefix => 'prefix'
|
||||
})
|
||||
data = service.get_bucket(key, options).body
|
||||
directory = new(:key => data['Name'])
|
||||
directory = new(:key => data['Name'], :is_persisted => true)
|
||||
options = {}
|
||||
for k, v in data
|
||||
if ['CommonPrefixes', 'Delimiter', 'IsTruncated', 'Marker', 'MaxKeys', 'Prefix'].include?(k)
|
||||
|
|
|
@ -108,10 +108,17 @@ module Fog
|
|||
end
|
||||
|
||||
service.put_bucket(key, options)
|
||||
attributes[:is_persisted] = true
|
||||
|
||||
true
|
||||
end
|
||||
|
||||
def persisted?
|
||||
# is_persisted is true in case of directories.get or after #save
|
||||
# creation_date is set in case of directories.all
|
||||
attributes[:is_persisted] || !!attributes[:creation_date]
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def bucket_location
|
||||
|
|
Loading…
Add table
Reference in a new issue