mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
content_tag_string shouldn't escape_html if escape param is false
This commit is contained in:
parent
eebac02606
commit
399b493cb4
2 changed files with 3 additions and 1 deletions
|
@ -110,7 +110,7 @@ module ActionView
|
|||
|
||||
def content_tag_string(name, content, options, escape = true)
|
||||
tag_options = tag_options(options, escape) if options
|
||||
"<#{name}#{tag_options}>#{ERB::Util.h(content)}</#{name}>".html_safe
|
||||
"<#{name}#{tag_options}>#{escape ? ERB::Util.h(content) : content}</#{name}>".html_safe
|
||||
end
|
||||
|
||||
def tag_options(options, escape = true)
|
||||
|
|
|
@ -39,6 +39,8 @@ class TagHelperTest < ActionView::TestCase
|
|||
content_tag("a", "Create", :href => "create")
|
||||
assert_equal "<p><script>evil_js</script></p>",
|
||||
content_tag(:p, '<script>evil_js</script>')
|
||||
assert_equal "<p><script>evil_js</script></p>",
|
||||
content_tag(:p, '<script>evil_js</script>', nil, false)
|
||||
end
|
||||
|
||||
def test_content_tag_with_block_in_erb
|
||||
|
|
Loading…
Reference in a new issue