Ticket #9777: fix_controller_segment_regexp_chunk_double_escape.diff
| File fix_controller_segment_regexp_chunk_double_escape.diff, 1.4 kB (added by pythonic, 1 year ago) |
|---|
-
trunk/actionpack/test/controller/routing_test.rb
old new 879 879 class ControllerSegmentTest < Test::Unit::TestCase 880 880 881 881 def test_regexp_should_only_match_possible_controllers 882 ActionController::Routing.with_controllers %w(admin/accounts admin/users account pages ) do882 ActionController::Routing.with_controllers %w(admin/accounts admin/users account pages tasty-beverages) do 883 883 cs = ROUTING::ControllerSegment.new :controller 884 884 regexp = %r{\A#{cs.regexp_chunk}\Z} 885 885 -
trunk/actionpack/lib/action_controller/routing.rb
old new 766 766 767 767 class ControllerSegment < DynamicSegment #:nodoc: 768 768 def regexp_chunk 769 possible_names = Routing.possible_controllers.collect { |name| Regexp.escape name } 770 "(?i-:(#{(regexp || Regexp.union(*possible_names)).source}))" 769 "(?i-:(#{(regexp || Regexp.union(*Routing.possible_controllers)).source}))" 771 770 end 772 771 773 772 # Don't URI.escape the controller name since it may contain slashes.