mirror of
https://github.com/redmine/redmine.git
synced 2026-01-22 15:33:22 +01:00
HTML-escape the entire tag content of escaped HTML tags in textile (#38807).
Patch by Holger Just. git-svn-id: https://svn.redmine.org/redmine/trunk@22302 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
@@ -1214,9 +1214,9 @@ class RedCloth3 < String
|
||||
all, tag, close = $1, $2, $3
|
||||
|
||||
if close.present? && (ALLOWED_TAGS.include?(tag) || (tag =~ /\Aredpre#\d+\z/))
|
||||
"<#{all}#{close}"
|
||||
"<#{htmlesc all}#{close}"
|
||||
else
|
||||
"<#{all}#{'>' unless close.blank?}"
|
||||
"<#{htmlesc all}#{'>' unless close.blank?}"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1296,12 +1296,13 @@ class ApplicationHelperTest < Redmine::HelperTest
|
||||
def test_html_tags
|
||||
to_test = {
|
||||
"<div>content</div>" => "<p><div>content</div></p>",
|
||||
"<div class=\"bold\">content</div>" => "<p><div class=\"bold\">content</div></p>",
|
||||
"<div class=\"bold\">content</div>" => "<p><div class="bold">content</div></p>",
|
||||
"<script>some script;</script>" => "<p><script>some script;</script></p>",
|
||||
# do not escape pre/code tags
|
||||
"<pre>\nline 1\nline2</pre>" => "<pre>\nline 1\nline2</pre>",
|
||||
"<pre><code>\nline 1\nline2</code></pre>" => "<pre><code>\nline 1\nline2</code></pre>",
|
||||
"<pre><div>content</div></pre>" => "<pre><div>content</div></pre>",
|
||||
"<pre><div class=\"foo\">content</div></pre>" => "<pre><div class=\"foo\">content</div></pre>",
|
||||
"<pre><div class=\"<foo\">content</div></pre>" => "<pre><div class=\"<foo\">content</div></pre>",
|
||||
"<!-- opening comment" => "<p><!-- opening comment</p>",
|
||||
# remove attributes including class
|
||||
"<pre class='foo'>some text</pre>" => "<pre>some text</pre>",
|
||||
|
||||
Reference in New Issue
Block a user