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

Changed the encoding of the space character

Space characters are now encoded as %20. This is recommended in:
http://docs.amazonwebservices.com/AWSEC2/latest/UserGuide/index.html?using-query-api.html
This commit is contained in:
croaker 2011-07-13 11:13:59 +02:00
parent 867a352a0f
commit bfa6685c7f
2 changed files with 3 additions and 3 deletions

View file

@ -46,9 +46,9 @@ module Fog
end
def self.escape(string)
string.gsub(/([^ a-zA-Z0-9_.\-~]+)/) {
string.gsub(/([^a-zA-Z0-9_.\-~]+)/) {
"%" + $1.unpack("H2" * $1.bytesize).join("%").upcase
}.tr(" ", "+")
}
end
def self.signed_params(params, options = {})

View file

@ -1,5 +1,5 @@
# encoding: utf-8
Shindo.tests('AWS | signed_params', ['aws']) do
returns( Fog::AWS.escape( "'Stöp!' said Fred_-~." ) ) { "%27St%C3%B6p%21%27+said+Fred_-~." }
returns( Fog::AWS.escape( "'Stöp!' said Fred_-~." ) ) { "%27St%C3%B6p%21%27%20said%20Fred_-~." }
end