Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fix that routes with *path segments in the recall can generate URLs. …

…[Rick]

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4454 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information...
commit 2bbcff8cf4488c0f64bf5ac23e9b5a8eb13f07d5 1 parent 36dc94a
@technoweenie technoweenie authored
View
2  actionpack/CHANGELOG
@@ -1,5 +1,7 @@
*SVN*
+* Fix that routes with *path segments in the recall can generate URLs. [Rick]
+
* Fix strip_links so that it doesn't hang on multiline <acronym> tags [Jamis Buck]
* Remove problematic control chars in rescue template. #5316 [Stefan Kaes]
View
2  actionpack/lib/action_controller/routing.rb
@@ -581,7 +581,7 @@ def match_extraction(next_capture)
class PathSegment < DynamicSegment
EscapedSlash = CGI.escape("/")
def interpolation_chunk
- "\#{CGI.escape(#{local_name}).gsub(#{EscapedSlash.inspect}, '/')}"
+ "\#{CGI.escape(#{local_name}.to_s).gsub(#{EscapedSlash.inspect}, '/')}"
end
def default
View
9 actionpack/test/controller/routing_test.rb
@@ -214,6 +214,15 @@ def test_dynamic_path_allowed
assert_equal '/pages/boo', rs.generate(:controller => 'content', :action => 'show_file', :path => %w(pages boo))
end
+ def test_dynamic_recall_paths_allowed
+ rs.draw do |map|
+ map.connect '*path', :controller => 'content', :action => 'show_file'
+ end
+
+ recall_path = ActionController::Routing::PathSegment::Result.new(%w(pages boo))
+ assert_equal '/pages/boo', rs.generate({}, :controller => 'content', :action => 'show_file', :path => recall_path)
+ end
+
def test_backwards
rs.draw do |map|
map.connect 'page/:id/:action', :controller => 'pages', :action => 'show'
Please sign in to comment.
Something went wrong with that request. Please try again.