mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
use path style access for https public_urls that include . to avoid certificate issues
closes #743
This commit is contained in:
parent
6a89912cff
commit
80ca32bfdd
2 changed files with 2 additions and 2 deletions
|
@ -91,7 +91,7 @@ module Fog
|
|||
def public_url
|
||||
requires :key
|
||||
if connection.get_bucket_acl(key).body['AccessControlList'].detect {|grant| grant['Grantee']['URI'] == 'http://acs.amazonaws.com/groups/global/AllUsers' && grant['Permission'] == 'READ'}
|
||||
if key.to_s =~ /^(?:[a-z]|\d(?!\d{0,2}(?:\.\d{1,3}){3}$))(?:[a-z0-9]|\.(?![\.\-])|\-(?![\.])){1,61}[a-z0-9]$/
|
||||
if key.to_s =~ /^(?:[a-z]|\d(?!\d{0,2}(?:\.\d{1,3}){3}$))(?:[a-z0-9]|\-(?![\.])){1,61}[a-z0-9]$/
|
||||
"https://#{key}.s3.amazonaws.com"
|
||||
else
|
||||
"https://s3.amazonaws.com/#{key}"
|
||||
|
|
|
@ -95,7 +95,7 @@ module Fog
|
|||
def public_url
|
||||
requires :directory, :key
|
||||
if connection.get_object_acl(directory.key, key).body['AccessControlList'].detect {|grant| grant['Grantee']['URI'] == 'http://acs.amazonaws.com/groups/global/AllUsers' && grant['Permission'] == 'READ'}
|
||||
if directory.key.to_s =~ /^(?:[a-z]|\d(?!\d{0,2}(?:\.\d{1,3}){3}$))(?:[a-z0-9]|\.(?![\.\-])|\-(?![\.])){1,61}[a-z0-9]$/
|
||||
if directory.key.to_s =~ /^(?:[a-z]|\d(?!\d{0,2}(?:\.\d{1,3}){3}$))(?:[a-z0-9]|\-(?![\.])){1,61}[a-z0-9]$/
|
||||
"https://#{directory.key}.s3.amazonaws.com/#{Fog::AWS.escape(key)}"
|
||||
else
|
||||
"https://s3.amazonaws.com/#{directory.key}/#{Fog::AWS.escape(key)}"
|
||||
|
|
Loading…
Reference in a new issue