aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_dispatch/routing/mapper.rb
diff options
context:
space:
mode:
authorPratik Naik <pratiknaik@gmail.com>2010-01-28 19:46:17 +0000
committerPratik Naik <pratiknaik@gmail.com>2010-01-28 19:46:17 +0000
commit285361d1589002fcdd1584c07e6eb295f13c9f37 (patch)
tree2d50a69b3b59b6fb3cb7577b990fe3b1aaf58f4f /actionpack/lib/action_dispatch/routing/mapper.rb
parentdfa19408651ecc82e2aeba95d93db871ba8a6e41 (diff)
parentd58398c2b5e98aad18dc72790230f338c10d145c (diff)
downloadrails-285361d1589002fcdd1584c07e6eb295f13c9f37.tar.gz
rails-285361d1589002fcdd1584c07e6eb295f13c9f37.tar.bz2
rails-285361d1589002fcdd1584c07e6eb295f13c9f37.zip
Merge remote branch 'mainstream/master'
Conflicts: railties/lib/rails/railtie.rb
Diffstat (limited to 'actionpack/lib/action_dispatch/routing/mapper.rb')
-rw-r--r--actionpack/lib/action_dispatch/routing/mapper.rb5
1 files changed, 3 insertions, 2 deletions
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