From a19bac86311029a2bb6c7df940cc905686adc9cd Mon Sep 17 00:00:00 2001 From: Matt Palmer Date: Sun, 6 Mar 2011 14:00:31 +1100 Subject: [PATCH] URI.escape is sensitive about being given strings to escape --- lib/sinatra/url_for.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/sinatra/url_for.rb b/lib/sinatra/url_for.rb index 02a84d3..0edac0e 100644 --- a/lib/sinatra/url_for.rb +++ b/lib/sinatra/url_for.rb @@ -38,7 +38,7 @@ def url_for url_fragment, mode=nil, options = nil optstring = nil if options.is_a? Hash - optstring = '?' + options.map { |k,v| "#{k}=#{URI.escape(v, /[^#{URI::PATTERN::UNRESERVED}]/)}" }.join('&') + optstring = '?' + options.map { |k,v| "#{k}=#{URI.escape(v.to_s, /[^#{URI::PATTERN::UNRESERVED}]/)}" }.join('&') end case mode