mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
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
This commit is contained in:
parent
36dc94a6a1
commit
2bbcff8cf4
3 changed files with 12 additions and 1 deletions
|
@ -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 @@ module ActionController
|
|||
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 @@ class LegacyRouteSetTests < Test::Unit::TestCase
|
|||
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'
|
||||
|
|
Loading…
Reference in a new issue