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

Add fix for special chars. in CDN-enabled container names.

This commit is contained in:
Rupak Ganguly 2011-10-21 17:43:17 -04:00
parent b1d6b001b6
commit 102646581c
4 changed files with 16 additions and 3 deletions

View file

@ -17,7 +17,19 @@ module Fog
request :put_container
request :delete_container
module Utils
# 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
include Utils
def self.data
@data ||= Hash.new do |hash, key|
@ -44,6 +56,7 @@ module Fog
end
class Real
include Utils
def initialize(options={})
require 'multi_json'

View file

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

View file

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

View file

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