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

[openstack|storage] Added OpenStack.escape utility method

Required by OpenStack Storage service.
This commit is contained in:
Sergio Rubio 2013-01-23 20:53:29 +01:00
parent 2deb89e017
commit 433985bfee

View file

@ -200,6 +200,13 @@ module Fog
Fog::JSON.decode(response.body)
end
# CGI.escape, but without special treatment on spaces
def self.escape(str,extra_exclude_chars = '')
str.gsub(/([^a-zA-Z0-9_.-#{extra_exclude_chars}]+)/) do
'%' + $1.unpack('H2' * $1.bytesize).join('%').upcase
end
end
end
end