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

Don’t escape '/' characters in keys

Add test for this behaviour
This commit is contained in:
Keith Duncan 2013-09-02 13:12:46 +01:00
parent 31f101f824
commit 95b353ff7f
2 changed files with 5 additions and 1 deletions

View file

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

View file

@ -2,4 +2,8 @@
Shindo.tests('AWS | signed_params', ['aws']) do Shindo.tests('AWS | signed_params', ['aws']) do
returns( Fog::AWS.escape( "'Stöp!' said Fred_-~." ) ) { "%27St%C3%B6p%21%27%20said%20Fred_-~." } returns( Fog::AWS.escape( "'Stöp!' said Fred_-~." ) ) { "%27St%C3%B6p%21%27%20said%20Fred_-~." }
tests('Keys can contain a hierarchical prefix which should not be escaped') do
returns( Fog::AWS.escape( "key/with/prefix" ) ) { "key/with/prefix" }
end
end end