From 8974dac92e05dcab8ee552a5f40108c6ac25dc36 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Tue, 26 Jan 2010 00:55:26 +0100 Subject: Ensure root routes inside optional scopes works as expected. --- actionpack/lib/action_dispatch/routing/mapper.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'actionpack/lib/action_dispatch') diff --git a/actionpack/lib/action_dispatch/routing/mapper.rb b/actionpack/lib/action_dispatch/routing/mapper.rb index fcbb70749f..5199984814 100644 --- a/actionpack/lib/action_dispatch/routing/mapper.rb +++ b/actionpack/lib/action_dispatch/routing/mapper.rb @@ -157,10 +157,11 @@ module ActionDispatch end # Invokes Rack::Mount::Utils.normalize path and ensure that - # (:locale) becomes (/:locale) instead of /(:locale). + # (:locale) becomes (/:locale) instead of /(:locale). Except + # for root cases, where the latter is the correct one. def self.normalize_path(path) path = Rack::Mount::Utils.normalize_path(path) - path.sub!(%r{/\(+/?:}, '(/:') + path.sub!(%r{/(\(+)/?:}, '\1/:') unless path =~ %r{^/\(+:.*\)$} path end -- cgit v1.2.3