Permalink
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...
1 parent 36dc94a commit 2bbcff8cf4488c0f64bf5ac23e9b5a8eb13f07d5 @technoweenie technoweenie committed Jun 17, 2006
View
@@ -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]
@@ -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
@@ -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'

0 comments on commit 2bbcff8

Please sign in to comment.