summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/redmine/wiki_formatting/textile/redcloth3.rb4
-rw-r--r--test/helpers/application_helper_test.rb5
2 files changed, 5 insertions, 4 deletions
diff --git a/lib/redmine/wiki_formatting/textile/redcloth3.rb b/lib/redmine/wiki_formatting/textile/redcloth3.rb
index f0595f438..a2b53997f 100644
--- a/lib/redmine/wiki_formatting/textile/redcloth3.rb
+++ b/lib/redmine/wiki_formatting/textile/redcloth3.rb
@@ -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
- "&lt;#{all}#{'&gt;' unless close.blank?}"
+ "&lt;#{htmlesc all}#{'&gt;' unless close.blank?}"
end
end
end
diff --git a/test/helpers/application_helper_test.rb b/test/helpers/application_helper_test.rb
index ddc55dcb8..a9e3b3a74 100644
--- a/test/helpers/application_helper_test.rb
+++ b/test/helpers/application_helper_test.rb
@@ -1296,12 +1296,13 @@ class ApplicationHelperTest < Redmine::HelperTest
def test_html_tags
to_test = {
"<div>content</div>" => "<p>&lt;div&gt;content&lt;/div&gt;</p>",
- "<div class=\"bold\">content</div>" => "<p>&lt;div class=\"bold\"&gt;content&lt;/div&gt;</p>",
+ "<div class=\"bold\">content</div>" => "<p>&lt;div class=&quot;bold&quot;&gt;content&lt;/div&gt;</p>",
"<script>some script;</script>" => "<p>&lt;script&gt;some script;&lt;/script&gt;</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>&lt;div&gt;content&lt;/div&gt;</pre>",
+ "<pre><div class=\"foo\">content</div></pre>" => "<pre>&lt;div class=\"foo\"&gt;content&lt;/div&gt;</pre>",
+ "<pre><div class=\"<foo\">content</div></pre>" => "<pre>&lt;div class=\"&lt;foo\"&gt;content&lt;/div&gt;</pre>",
"<!-- opening comment" => "<p>&lt;!-- opening comment</p>",
# remove attributes including class
"<pre class='foo'>some text</pre>" => "<pre>some text</pre>",