diff options
author | Nicholas Seckar <nseckar@gmail.com> | 2006-08-05 22:12:50 +0000 |
---|---|---|
committer | Nicholas Seckar <nseckar@gmail.com> | 2006-08-05 22:12:50 +0000 |
commit | 127ee8c8f8103515929f31cf24fdc3d9b68d692d (patch) | |
tree | 796e057666e4a0f8dc51bb7a6bfefdc9f195aa5c /actionpack/lib/action_controller | |
parent | 900afae41b00b27c6f1fc53044fe4ca917f09c81 (diff) | |
download | rails-127ee8c8f8103515929f31cf24fdc3d9b68d692d.tar.gz rails-127ee8c8f8103515929f31cf24fdc3d9b68d692d.tar.bz2 rails-127ee8c8f8103515929f31cf24fdc3d9b68d692d.zip |
Make Routing noisy when an anchor regexp is assigned to a segment. Closes #5674
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4677 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionpack/lib/action_controller')
-rw-r--r-- | actionpack/lib/action_controller/routing.rb | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/actionpack/lib/action_controller/routing.rb b/actionpack/lib/action_controller/routing.rb index 7ca773469c..2911789892 100644 --- a/actionpack/lib/action_controller/routing.rb +++ b/actionpack/lib/action_controller/routing.rb @@ -679,7 +679,7 @@ module ActionController [defaults, requirements, conditions] end - + # Takes a hash of defaults and a hash of requirements, and assigns them to # the segments. Any unused requirements (which do not correspond to a segment) # are returned as a hash. @@ -694,6 +694,9 @@ module ActionController segment = segment_named[key] if segment raise TypeError, "#{key}: requirements on a path segment must be regular expressions" unless requirement.is_a?(Regexp) + if requirement.source =~ %r{\\A|\\Z|\\z|\^|\$} + raise ArgumentError, "Regexp anchor characters are not allowed in routing requirements: #{requirement.inspect}" + end segment.regexp = requirement else route_requirements[key] = requirement |