mirror of
https://github.com/github/rails.git
synced 2026-04-26 03:00:59 -04:00
Revert "Merge pull request #275 from pk-amooma/master"
Several AP tests fail after this change. This reverts commitaaf01cd537, reversing changes made to9cc18c52fa.
This commit is contained in:
@@ -3,7 +3,7 @@ require 'active_support/core_ext/kernel/singleton_class'
|
||||
|
||||
class ERB
|
||||
module Util
|
||||
XML_ESCAPE = { '&' => '&', '>' => '>', '<' => '<', '"' => '"', "'" => ''' }
|
||||
HTML_ESCAPE = { '&' => '&', '>' => '>', '<' => '<', '"' => '"' }
|
||||
JSON_ESCAPE = { '&' => '\u0026', '>' => '\u003E', '<' => '\u003C' }
|
||||
|
||||
# A utility method for escaping HTML tag characters.
|
||||
@@ -20,7 +20,7 @@ class ERB
|
||||
if s.html_safe?
|
||||
s
|
||||
else
|
||||
s.gsub(/[&"'><]/) { |special| XML_ESCAPE[special] }.html_safe
|
||||
s.gsub(/[&"><]/) { |special| HTML_ESCAPE[special] }.html_safe
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -387,18 +387,6 @@ class OutputSafetyTest < ActiveSupport::TestCase
|
||||
assert !@other_combination.html_safe?
|
||||
end
|
||||
|
||||
test "Escapes special HTML/XML characters" do
|
||||
@other_string = "other".html_safe
|
||||
@combination = @other_string + "<foo>&\"'"
|
||||
@other_combination = @string + "<foo>&\"'"
|
||||
|
||||
assert_equal "other<foo>&"'", @combination
|
||||
assert_equal "hello<foo>&\"'", @other_combination
|
||||
|
||||
assert @combination.html_safe?
|
||||
assert !@other_combination.html_safe?
|
||||
end
|
||||
|
||||
test "Concatting safe onto unsafe yields unsafe" do
|
||||
@other_string = "other"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user