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:
parent
2deb89e017
commit
433985bfee
1 changed files with 7 additions and 0 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Reference in a new issue