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:
parent
76a8f0f2e7
commit
05208f881c
9 changed files with 18 additions and 8 deletions
|
@ -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
|
||||
|
|
|
@ -12,7 +12,7 @@ module Fog
|
|||
response = request(
|
||||
:expects => 204,
|
||||
:method => 'DELETE',
|
||||
:path => URI.escape(name)
|
||||
:path => escape_name(name)
|
||||
)
|
||||
response
|
||||
end
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -17,7 +17,7 @@ module Fog
|
|||
response = request(
|
||||
:expects => 204,
|
||||
:method => 'HEAD',
|
||||
:path => URI.escape(container),
|
||||
:path => escape_name(container),
|
||||
:query => {'format' => 'json'}
|
||||
)
|
||||
response
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -13,7 +13,7 @@ module Fog
|
|||
:expects => [201, 202],
|
||||
:headers => options,
|
||||
:method => 'PUT',
|
||||
:path => URI.escape(name)
|
||||
:path => escape_name(name)
|
||||
)
|
||||
response
|
||||
end
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue