1
0
Fork 0
mirror of https://github.com/fog/fog.git synced 2022-11-09 13:51:43 -05:00

if creating an s3 directory (bucket), one needs to pass in :location as well as have the aws connection set to the correct region...

This commit is contained in:
Adam Greene 2011-06-05 19:37:50 -07:00
parent ceadcb9518
commit bf28b55821
2 changed files with 11 additions and 4 deletions

View file

@ -70,7 +70,16 @@ module Fog
query << "Expires=#{params[:headers]['Date']}"
"https://#{@host}/#{params[:path]}?#{query.join('&')}"
end
def host
@host
end
def region
region = @region || host.split('.').first.gsub(/s3-?/, '')
region.empty? ? 'us-east-1' : region
end
end
class Mock

View file

@ -86,9 +86,7 @@ module Fog
if @acl
options['x-amz-acl'] = @acl
end
if @location
options['LocationConstraint'] = @location
end
options['LocationConstraint'] = @location || self.connection.region
connection.put_bucket(key, options)
true
end