mirror of
https://github.com/redmine/redmine.git
synced 2026-01-26 17:30:00 +01:00
Merged r22302 and r22303 from trunk to 4.2-stable (#38807).
git-svn-id: https://svn.redmine.org/redmine/branches/4.2-stable@22305 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
@@ -840,7 +840,7 @@ class RedCloth3 < String
|
||||
end
|
||||
|
||||
url = htmlesc(url.dup)
|
||||
next all if url.downcase.start_with?('javascript:')
|
||||
next all unless uri_with_link_safe_scheme?(url)
|
||||
|
||||
atts = pba(atts)
|
||||
atts = +" href=\"#{url}#{slash}\"#{atts}"
|
||||
@@ -964,7 +964,7 @@ class RedCloth3 < String
|
||||
next m unless uri_with_safe_scheme?(url.partition('?').first)
|
||||
if href
|
||||
href = htmlesc(href.dup)
|
||||
next m if href.downcase.start_with?('javascript:')
|
||||
next m unless uri_with_link_safe_scheme?(href)
|
||||
end
|
||||
|
||||
out = +''
|
||||
@@ -1213,9 +1213,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
|
||||
|
||||
@@ -1220,12 +1220,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>",
|
||||
"HTML comment: <!-- no comments -->" => "<p>HTML comment: <!-- no comments --></p>",
|
||||
"<!-- opening comment" => "<p><!-- opening comment</p>",
|
||||
# remove attributes including class
|
||||
|
||||
Reference in New Issue
Block a user