Skip to content

Commit

Permalink
Revert "Don't remove trailing slash from PATH_INFO for mounted apps"
Browse files Browse the repository at this point in the history
The revert is needed because of a regression described in #13369, routes
with trailing slash are no longer recognized properly.

This reverts commit 50311f1.
  • Loading branch information
drogus committed Jan 16, 2014
1 parent 73d8a90 commit 2e0f9ed
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 18 deletions.
6 changes: 0 additions & 6 deletions actionpack/CHANGELOG.md
Expand Up @@ -431,10 +431,4 @@


*Piotr Sarnacki*, *Łukasz Strzałkowski* *Piotr Sarnacki*, *Łukasz Strzałkowski*


* Fix removing trailing slash for mounted apps.

Fixes #3215.

*Piotr Sarnacki*

Please check [4-0-stable](https://github.com/rails/rails/blob/4-0-stable/actionpack/CHANGELOG.md) for previous changes. Please check [4-0-stable](https://github.com/rails/rails/blob/4-0-stable/actionpack/CHANGELOG.md) for previous changes.
8 changes: 1 addition & 7 deletions actionpack/lib/action_dispatch/journey/router.rb
Expand Up @@ -54,7 +54,7 @@ def initialize(routes, options)
end end


def call(env) def call(env)
env['PATH_INFO'] = normalize_path(env['PATH_INFO']) env['PATH_INFO'] = Utils.normalize_path(env['PATH_INFO'])


find_routes(env).each do |match, parameters, route| find_routes(env).each do |match, parameters, route|
script_name, path_info, set_params = env.values_at('SCRIPT_NAME', script_name, path_info, set_params = env.values_at('SCRIPT_NAME',
Expand Down Expand Up @@ -103,12 +103,6 @@ def visualizer


private private


def normalize_path(path)
path = "/#{path}"
path.squeeze!('/')
path
end

def partitioned_routes def partitioned_routes
routes.partitioned_routes routes.partitioned_routes
end end
Expand Down
5 changes: 0 additions & 5 deletions actionpack/test/dispatch/mount_test.rb
Expand Up @@ -44,11 +44,6 @@ def test_app_name_is_properly_generated_when_engine_is_mounted_in_resources
"A named route should be defined with a parent's prefix" "A named route should be defined with a parent's prefix"
end end


def test_trailing_slash_is_not_removed_from_path_info
get "/sprockets/omg/"
assert_equal "/sprockets -- /omg/", response.body
end

def test_mounting_sets_script_name def test_mounting_sets_script_name
get "/sprockets/omg" get "/sprockets/omg"
assert_equal "/sprockets -- /omg", response.body assert_equal "/sprockets -- /omg", response.body
Expand Down

0 comments on commit 2e0f9ed

Please sign in to comment.