1
0
Fork 0
mirror of https://github.com/sinatra/sinatra synced 2023-03-27 23:18:01 -04:00

Merge remote-tracking branch 'upstream/master'

This commit is contained in:
michelc 2012-02-21 19:28:58 +01:00
commit ed397dcbcf
2 changed files with 12 additions and 1 deletions

View file

@ -825,7 +825,7 @@ module Sinatra
route = @request.path_info
route = '/' if route.empty? and not settings.empty_path_info?
return unless match = pattern.match(route)
values += match.captures.to_a.map { |v| force_encoding URI.decode(v) if v }
values += match.captures.to_a.map { |v| force_encoding URI.decode_www_form_component(v) if v }
if values.any?
original, @params = params, params.merge('splat' => [], 'captures' => values)

View file

@ -329,6 +329,17 @@ class RoutingTest < Test::Unit::TestCase
assert not_found?
end
it "converts plus sign into space as the value of a named param" do
mock_app {
get '/:test' do
params["test"]
end
}
get '/bob+ross'
assert ok?
assert_equal 'bob ross', body
end
it "literally matches parens in paths" do
route_def '/test(bar)/'