mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
There is a bug here or maybe i'm using the gem wrong...
Edit you should merge the ACLs after merging the meta_has if not The new permission will be overwritten by the old one. If Before you had a directory with : X-Container-Read: .r:*,.rlistings and you make your directory private again. The new read_acl will be overwritten by the old one in the mata_hash
This commit is contained in:
parent
0aad0e5e7d
commit
f49d604486
1 changed files with 12 additions and 6 deletions
|
@ -248,8 +248,15 @@ module Fog
|
|||
end
|
||||
end
|
||||
|
||||
def save(options = {})
|
||||
def save(new_options = {})
|
||||
requires :key
|
||||
options = {}
|
||||
#these are default/previous options
|
||||
meta_hash = {}
|
||||
metadata.each { |meta| meta_hash.store(meta.key, meta.value) }
|
||||
if meta_hash
|
||||
options.merge!(meta_hash)
|
||||
end
|
||||
# write out the acls into the headers before save
|
||||
options.merge!(service.perm_acl_to_header(@read_acl, @write_acl))
|
||||
options.merge!({'X-Container-Sync-To' => self.sync_to}) unless self.sync_to.nil?
|
||||
|
@ -259,11 +266,10 @@ module Fog
|
|||
options.merge!({'X-Container-Meta-Web-Listings-Css' => self.web_listings_css}) unless self.web_listings_css.nil?
|
||||
options.merge!({'X-Container-Meta-Web-Error' => self.web_error}) unless self.web_error.nil?
|
||||
# get the metadata and merge them in
|
||||
meta_hash = {}
|
||||
metadata.each { |meta| meta_hash.store(meta.key, meta.value) }
|
||||
if meta_hash
|
||||
options.merge!(meta_hash)
|
||||
end
|
||||
|
||||
# merge user options at the end
|
||||
options.merge!(new_options)
|
||||
|
||||
service.put_container(key, options)
|
||||
# Added an extra check to see if CDN is enabled for the container
|
||||
if (!service.cdn.nil? && service.cdn.enabled?)
|
||||
|
|
Loading…
Reference in a new issue