Skip to content

Commit

Permalink
Merge pull request #600 from cwjenkins/add_uniform
Browse files Browse the repository at this point in the history
Add uniform attr to inserting file
  • Loading branch information
Temikus authored Aug 10, 2023
2 parents f660fbe + 07f5c7c commit 0b6252d
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions lib/fog/storage/google_json/models/file.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ class File < Fog::Model
identity :key, :aliases => ["Key", :name]

attribute :acl
attribute :uniform
attribute :predefined_acl, :aliases => ["predefinedAcl", :predefined_acl]
attribute :cache_control, :aliases => ["cacheControl", :cache_control]
attribute :content_disposition, :aliases => ["contentDisposition", :content_disposition]
Expand Down Expand Up @@ -37,6 +38,10 @@ class File < Fog::Model
"publicReadWrite"
].freeze

def uniform=(enable)
@uniform=enable
end

def predefined_acl=(new_predefined_acl)
unless VALID_PREDEFINED_ACLS.include?(new_predefined_acl)
raise ArgumentError.new("acl must be one of [#{VALID_PREDEFINED_ACLS.join(', ')}]")
Expand Down Expand Up @@ -111,8 +116,8 @@ def save
FILE_INSERTABLE_FIELDS.map { |k| [k, attributes[k]] }
.reject { |pair| pair[1].nil? }
]
options[:predefined_acl] ||= @predefined_acl

options[:predefined_acl] ||= @predefined_acl unless @uniform

service.put_object(directory.key, key, body, **options)
self.content_length = Fog::Storage.get_body_size(body)
Expand Down

0 comments on commit 0b6252d

Please sign in to comment.