Efficiency: Entity handling
Previously, used a regexp to find and convert named entities in the content. Now use a more efficient algorithm. Similar tweak for converting NCRs before checking whether text is valid utf-8.
This commit is contained in:
parent
5ca0760f7c
commit
41346bf8bd
7 changed files with 50 additions and 29 deletions
|
@ -344,6 +344,13 @@ class PageRendererTest < Test::Unit::TestCase
|
|||
"</ins> and lovely morning<ins class='diffins'> today</ins></span></p>", test_renderer(@page.revisions.last).display_diff
|
||||
end
|
||||
|
||||
def test_nowiki_sanitization
|
||||
assert_markup_parsed_as('<p>This sentence contains <span>a & b</span> ' +
|
||||
'<script>alert("XSS!");</script>. Do not touch!</p>',
|
||||
'This sentence contains <nowiki><span>a & b</span> <script>alert("XSS!");' +
|
||||
'</script></nowiki>. Do not touch!')
|
||||
end
|
||||
|
||||
def test_link_to_file
|
||||
assert_markup_parsed_as(
|
||||
"<p><span class='newWikiWord'>doc.pdf<a href='../file/doc.pdf'>?</a></span></p>",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue