mirror of
https://github.com/meineerde/redmine.git
synced 2025-12-19 15:01:14 +00:00
Fixed that less-than sign is not escaped by textile formatter (#6969).
git-svn-id: http://svn.redmine.org/redmine/trunk@14812 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
495be400a1
commit
c6283d7ce5
@ -1202,7 +1202,7 @@ class RedCloth3 < String
|
|||||||
ALLOWED_TAGS = %w(redpre pre code notextile)
|
ALLOWED_TAGS = %w(redpre pre code notextile)
|
||||||
|
|
||||||
def escape_html_tags(text)
|
def escape_html_tags(text)
|
||||||
text.gsub!(%r{<(\/?([!\w]+)[^<>\n]*)(>?)}) {|m| ALLOWED_TAGS.include?($2) ? "<#{$1}#{$3}" : "<#{$1}#{'>' unless $3.blank?}" }
|
text.gsub!(%r{<(\/?([!\w]+)[^<>\n]*)?(>?)}) {|m| $2 && ALLOWED_TAGS.include?($2) ? "<#{$1}#{$3}" : "<#{$1}#{'>' unless $3.blank?}" }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@ -160,12 +160,19 @@ EXPECTED
|
|||||||
assert_equal expected.gsub(%r{\s+}, ''), to_html(raw).gsub(%r{\s+}, '')
|
assert_equal expected.gsub(%r{\s+}, ''), to_html(raw).gsub(%r{\s+}, '')
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_escaping
|
def test_should_escape_unallowed_tags
|
||||||
assert_html_output(
|
assert_html_output(
|
||||||
'this is a <script>' => 'this is a <script>'
|
'this is a <script>' => 'this is a <script>'
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_should_escape_less_than_signs
|
||||||
|
assert_html_output(
|
||||||
|
'<' => '<',
|
||||||
|
'1 < 2' => '1 < 2'
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
def test_use_of_backslashes_followed_by_numbers_in_headers
|
def test_use_of_backslashes_followed_by_numbers_in_headers
|
||||||
assert_html_output({
|
assert_html_output({
|
||||||
'h1. 2009\02\09' => '<h1>2009\02\09</h1>'
|
'h1. 2009\02\09' => '<h1>2009\02\09</h1>'
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user