Permalink
Browse files

Revert "Fix path encoding tests if Ruby version is 1.9.3"

This reverts commit 31dfc4f.

A bad combination of commits required this to be backported. The
original change to the tests here shouldn't have been backported. The
change to Rails master was technically incorrect.

What happened was `@tenderlove` and I made a change to Rack and then
wrote this commit to accompany it: #29062. This test was changed after
that and backported to Rails 4.2. It for some reason wasn't backported
to 5.0 or 5.1.

Then on release day we realize the build was failing for Ruby 2.0+ on
Rails 4.2 so I ended up backporting #29062 when it shouldn't have been.
The correct behavior was to not backport #29062 or #29095 to Rails 4.2.

This revert fixes that.
  • Loading branch information...
eileencodes committed Aug 1, 2017
1 parent 5e7fc65 commit 2c5517ecedeac45cbf6c741bb609b167d64f8547
Showing with 15 additions and 41 deletions.
  1. +15 −40 actionpack/test/dispatch/routing_test.rb
  2. +0 −1 actionpack/test/journey/router/utils_test.rb
@@ -4196,51 +4196,26 @@ def show
end
end
if RUBY_VERSION < '2.0.0'
test "invalid UTF-8 encoding returns a 400 Bad Request" do
with_routing do |set|
set.draw do
get "/bar/:id", :to => redirect("/foo/show/%{id}")
get "/foo/show(/:id)", :to => "test_invalid_urls/foo#show"
get "/foo(/:action(/:id))", :controller => "test_invalid_urls/foo"
get "/:controller(/:action(/:id))"
end
get "/%E2%EF%BF%BD%A6"
assert_response :bad_request
get "/foo/%E2%EF%BF%BD%A6"
assert_response :bad_request
get "/foo/show/%E2%EF%BF%BD%A6"
assert_response :bad_request
get "/bar/%E2%EF%BF%BD%A6"
assert_response :bad_request
test "invalid UTF-8 encoding is treated as ASCII 8BIT encode" do
with_routing do |set|
set.draw do
get "/bar/:id", :to => redirect("/foo/show/%{id}")
get "/foo/show(/:id)", :to => "test_invalid_urls/foo#show"
get "/foo(/:action(/:id))", :controller => "test_invalid_urls/foo"
get "/:controller(/:action(/:id))"
end
end
else
test "invalid UTF-8 encoding is treated as ASCII 8BIT encode" do
with_routing do |set|
set.draw do
get "/bar/:id", :to => redirect("/foo/show/%{id}")
get "/foo/show(/:id)", :to => "test_invalid_urls/foo#show"
get "/foo(/:action(/:id))", :controller => "test_invalid_urls/foo"
get "/:controller(/:action(/:id))"
end
get "/%E2%EF%BF%BD%A6"
assert_response :not_found
get "/%E2%EF%BF%BD%A6"
assert_response :not_found
get "/foo/%E2%EF%BF%BD%A6"
assert_response :not_found
get "/foo/%E2%EF%BF%BD%A6"
assert_response :not_found
get "/foo/show/%E2%EF%BF%BD%A6"
assert_response :ok
get "/foo/show/%E2%EF%BF%BD%A6"
assert_response :ok
get "/bar/%E2%EF%BF%BD%A6"
assert_response :redirect
end
get "/bar/%E2%EF%BF%BD%A6"
assert_response :redirect
end
end
end
@@ -34,7 +34,6 @@ def test_normalize_path_uppercase
end
def test_normalize_path_maintains_string_encoding
skip "#b is not defined" if RUBY_VERSION < '2.0.0'
path = "/foo%AAbar%AAbaz".b
assert_equal Encoding::ASCII_8BIT, Utils.normalize_path(path).encoding
end

0 comments on commit 2c5517e

Please sign in to comment.