]> gitweb.fluxo.info Git - puppet-stdlib.git/commitdiff
Adjust to use default URI.escape escape list
authorTomas Doran <bobtfish@bobtfish.net>
Tue, 2 Jul 2013 10:18:42 +0000 (11:18 +0100)
committerAdrien Thebo <git@somethingsinistral.net>
Mon, 22 Jul 2013 20:12:28 +0000 (13:12 -0700)
Conform to RFC per comments on: https://github.com/puppetlabs/puppetlabs-stdlib/pull/164

Conflicts:
lib/puppet/parser/functions/uriescape.rb
spec/unit/puppet/parser/functions/uriescape_spec.rb

lib/puppet/parser/functions/uriescape.rb
spec/unit/puppet/parser/functions/uriescape_spec.rb

index 67b93a64d761c7ad769a164fea22270217148836..0d81de5d108ce96096ee689c0b3b927801dc8a66 100644 (file)
@@ -15,7 +15,6 @@ module Puppet::Parser::Functions
 
     value = arguments[0]
     klass = value.class
-    unsafe = ":/?#[]@!$&'()*+,;= "
 
     unless [Array, String].include?(klass)
       raise(Puppet::ParseError, 'uriescape(): Requires either ' +
@@ -26,7 +25,7 @@ module Puppet::Parser::Functions
       # Numbers in Puppet are often string-encoded which is troublesome ...
       result = value.collect { |i| i.is_a?(String) ? URI.escape(i,unsafe) : i }
     else
-      result = URI.escape(value,unsafe)
+      result = URI.escape(value)
     end
 
     return result
index 371de46873d6559ffba96cef4e28af318e352810..7211c88783df3e99f753be7a27dd47d021f8929c 100644 (file)
@@ -13,8 +13,8 @@ describe "the uriescape function" do
   end
 
   it "should uriescape a string" do
-    result = scope.function_uriescape([":/?#[]@!$&'()*+,;= "])
-    result.should(eq('%3A%2F%3F%23%5B%5D%40%21%24%26%27%28%29%2A%2B%2C%3B%3D%20'))
+    result = scope.function_uriescape([":/?#[]@!$&'()*+,;= \"{}"])
+    result.should(eq(':/?%23[]@!$&\'()*+,;=%20%22%7B%7D'))
   end
 
   it "should do nothing if a string is already safe" do