未验证 提交 16e6d42b 编写于 作者: R Rafael França 提交者: GitHub

Merge pull request #34002 from gmcgibbon/fix_deeply_nested_scoped_root

Fix optionally scoped root route unscoped access
......@@ -402,7 +402,7 @@ def dispatcher(raise_on_name_error)
# for root cases, where the latter is the correct one.
def self.normalize_path(path)
path = Journey::Router::Utils.normalize_path(path)
path.gsub!(%r{/(\(+)/?}, '\1/') unless path =~ %r{^/\(+[^)]+\)$}
path.gsub!(%r{/(\(+)/?}, '\1/') unless path =~ %r{^/(\(+[^)]+\)){1,}$}
path
end
......
......@@ -1382,6 +1382,22 @@ def test_scoped_root_as_name
assert_equal "projects#index", @response.body
end
def test_optionally_scoped_root_unscoped_access
draw do
scope "(:locale)" do
scope "(:platform)" do
scope "(:browser)" do
root to: "projects#index"
end
end
end
end
assert_equal "/", root_path
get "/"
assert_equal "projects#index", @response.body
end
def test_scope_with_format_option
draw do
get "direct/index", as: :no_format_direct, format: false
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册