1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

/ is allowed in URI fragments

This commit is contained in:
Jeremy Kemper 2011-10-13 21:41:30 -07:00
parent ec37160664
commit bceec4c3c3
2 changed files with 3 additions and 3 deletions

View file

@ -45,7 +45,7 @@ module ActionDispatch
rewritten_url << (options[:trailing_slash] ? path.sub(/\?|\z/) { "/" + $& } : path)
rewritten_url << "?#{params.to_query}" unless params.empty?
rewritten_url << "##{Journey::Router::Utils.escape_uri(options[:anchor].to_param.to_s)}" if options[:anchor]
rewritten_url << "##{Journey::Router::Utils.escape_fragment(options[:anchor].to_param.to_s)}" if options[:anchor]
rewritten_url
end

View file

@ -70,9 +70,9 @@ class UrlRewriterTests < ActionController::TestCase
)
end
def test_anchor_should_be_cgi_escaped
def test_anchor_should_be_uri_escaped
assert_equal(
'http://test.host/c/a/i#anc%2Fhor',
'http://test.host/c/a/i#anc/hor',
@rewriter.rewrite(@routes, :controller => 'c', :action => 'a', :id => 'i', :anchor => Struct.new(:to_param).new('anc/hor'))
)
end