1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Merge pull request #12276 from kennyj/fix_12269

Fix an issue where router can't recognize downcased url encoding path.
This commit is contained in:
Rafael Mendonça França 2013-09-18 13:39:47 -07:00
commit 56bfd8a8c9
3 changed files with 11 additions and 0 deletions

View file

@ -1,3 +1,9 @@
* Fix an issue where router can't recognize downcased url encoding path.
Fixes #12269
*kennyj*
* Fix custom flash type definition. Misusage of the `_flash_types` class variable
caused an error when reloading controllers with custom flash types.

View file

@ -16,6 +16,7 @@ module ActionDispatch
path = "/#{path}"
path.squeeze!('/')
path.sub!(%r{/+\Z}, '')
path.gsub!(/(%[a-f0-9]{2}+)/) { $1.upcase }
path = '/' if path == ''
path
end

View file

@ -1904,6 +1904,10 @@ class RackMountIntegrationTests < ActiveSupport::TestCase
assert_equal({:controller => 'news', :action => 'index'}, @routes.recognize_path(URI.parser.escape('こんにちは/世界'), :method => :get))
end
def test_downcased_unicode_path
assert_equal({:controller => 'news', :action => 'index'}, @routes.recognize_path(URI.parser.escape('こんにちは/世界').downcase, :method => :get))
end
private
def sort_extras!(extras)
if extras.length == 2