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

Add special char. support including '?' in container and object names.

This commit is contained in:
Rupak Ganguly 2011-09-09 16:29:29 -04:00
parent 76a8f0f2e7
commit 05208f881c
9 changed files with 18 additions and 8 deletions

View file

@ -68,6 +68,16 @@ module Fog
acl = "public-read-write"
end
end
# Take care of container names with '?' in them
def escape_name(name)
if name.include?('?')
URI.escape(name).gsub('?', '%3F')
else
URI.escape(name)
end
end
end
class Mock

View file

@ -12,7 +12,7 @@ module Fog
response = request(
:expects => 204,
:method => 'DELETE',
:path => URI.escape(name)
:path => escape_name(name)
)
response
end

View file

@ -13,7 +13,7 @@ module Fog
response = request(
:expects => 204,
:method => 'DELETE',
:path => "#{URI.escape(container)}/#{URI.escape(object)}"
:path => "#{escape_name(container)}/#{escape_name(object)}"
)
response
end

View file

@ -33,7 +33,7 @@ module Fog
response = request(
:expects => 200,
:method => 'GET',
:path => URI.escape(container),
:path => escape_name(container),
:query => {'format' => 'json'}.merge!(options)
)
response

View file

@ -14,7 +14,7 @@ module Fog
:block => block,
:expects => 200,
:method => 'GET',
:path => "#{URI.escape(container)}/#{URI.escape(object)}"
:path => "#{escape_name(container)}/#{escape_name(object)}"
}, false, &block)
response
end

View file

@ -17,7 +17,7 @@ module Fog
response = request(
:expects => 204,
:method => 'HEAD',
:path => URI.escape(container),
:path => escape_name(container),
:query => {'format' => 'json'}
)
response

View file

@ -13,7 +13,7 @@ module Fog
response = request({
:expects => 200,
:method => 'HEAD',
:path => "#{URI.escape(container)}/#{URI.escape(object)}"
:path => "#{escape_name(container)}/#{escape_name(object)}"
}, false)
response
end

View file

@ -13,7 +13,7 @@ module Fog
:expects => [201, 202],
:headers => options,
:method => 'PUT',
:path => URI.escape(name)
:path => escape_name(name)
)
response
end

View file

@ -19,7 +19,7 @@ module Fog
:expects => 201,
:headers => headers,
:method => 'PUT',
:path => "#{URI.escape(container)}/#{URI.escape(object)}"
:path => "#{escape_name(container)}/#{escape_name(object)}"
)
response
end