diff --git a/lib/fog/google/models/storage/file.rb b/lib/fog/google/models/storage/file.rb index 3b66e578d..a2e2d7509 100644 --- a/lib/fog/google/models/storage/file.rb +++ b/lib/fog/google/models/storage/file.rb @@ -92,7 +92,13 @@ module Fog def public_url requires :directory, :key - if service.get_object_acl(directory.key, key).body['AccessControlList'].detect {|entry| entry['Scope']['type'] == 'AllUsers' && entry['Permission'] == 'READ'} + + acl = service.get_object_acl(directory.key, key).body['AccessControlList'] + access_granted = acl.detect do |entry| + entry['Scope']['type'] == 'AllUsers' && entry['Permission'] == 'READ' + end + + if access_granted 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}.storage.googleapis.com/#{key}" else diff --git a/lib/fog/google/parsers/storage/access_control_list.rb b/lib/fog/google/parsers/storage/access_control_list.rb index 40c37c400..75811a81b 100644 --- a/lib/fog/google/parsers/storage/access_control_list.rb +++ b/lib/fog/google/parsers/storage/access_control_list.rb @@ -17,8 +17,8 @@ module Fog when 'Entries' @in_entries = true when 'Scope' - key, value = attrs.first - @entry['Scope'][key] = value + struct = attrs.first + @entry['Scope'][struct.localname] = struct.value end end