r74530 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r74529‎ | r74530 | r74531 >
Date:22:20, 8 October 2010
Author:platonides
Status:ok (Comments)
Tags:
Comment:
Add parsertest for r74526.
Note that if we hadn't the first escaping, we would have a security vulnerability.
So be careful if you break this parser test.
Modified paths:
  • /trunk/phase3/maintenance/tests/parser/parserTests.txt (modified) (history)

Diff [purge]

Index: trunk/phase3/maintenance/tests/parser/parserTests.txt
@@ -4098,6 +4098,54 @@
40994099 !! end
41004100
41014101 !! test
 4102+Header with special characters (bug 25462)
 4103+!! input
 4104+The tooltips shall not show entities to the user (ie. be double escaped)
 4105+
 4106+== text > text ==
 4107+section 1
 4108+
 4109+== text < text ==
 4110+section 2
 4111+
 4112+== text & text ==
 4113+section 3
 4114+
 4115+== text ' text ==
 4116+section 4
 4117+
 4118+== text " text ==
 4119+section 5
 4120+!! result
 4121+<p>The tooltips shall not show entities to the user (ie. be double escaped)
 4122+</p>
 4123+<table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
 4124+<ul>
 4125+<li class="toclevel-1 tocsection-1"><a href="#text_.3E_text"><span class="tocnumber">1</span> <span class="toctext">text &gt; text</span></a></li>
 4126+<li class="toclevel-1 tocsection-2"><a href="#text_.3C_text"><span class="tocnumber">2</span> <span class="toctext">text &lt; text</span></a></li>
 4127+<li class="toclevel-1 tocsection-3"><a href="#text_.26_text"><span class="tocnumber">3</span> <span class="toctext">text &amp; text</span></a></li>
 4128+<li class="toclevel-1 tocsection-4"><a href="#text_.27_text"><span class="tocnumber">4</span> <span class="toctext">text ' text</span></a></li>
 4129+<li class="toclevel-1 tocsection-5"><a href="#text_.22_text"><span class="tocnumber">5</span> <span class="toctext">text " text</span></a></li>
 4130+</ul>
 4131+</td></tr></table>
 4132+<h2><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: text > text">edit</a>]</span> <span class="mw-headline" id="text_.3E_text"> text &gt; text </span></h2>
 4133+<p>section 1
 4134+</p>
 4135+<h2><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: text &lt; text">edit</a>]</span> <span class="mw-headline" id="text_.3C_text"> text &lt; text </span></h2>
 4136+<p>section 2
 4137+</p>
 4138+<h2><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: text &amp; text">edit</a>]</span> <span class="mw-headline" id="text_.26_text"> text &amp; text </span></h2>
 4139+<p>section 3
 4140+</p>
 4141+<h2><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: text ' text">edit</a>]</span> <span class="mw-headline" id="text_.27_text"> text ' text </span></h2>
 4142+<p>section 4
 4143+</p>
 4144+<h2><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Parser_test&amp;action=edit&amp;section=5" title="Edit section: text &quot; text">edit</a>]</span> <span class="mw-headline" id="text_.22_text"> text " text </span></h2>
 4145+<p>section 5
 4146+</p>
 4147+!! end
 4148+
 4149+!! test
41024150 BUG 1219 URL next to image (broken)
41034151 !! input
41044152 http://example.com[[Image:foobar.jpg]]

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r74526Fix double-escaping for section edit link tooltips...simetrical18:52, 8 October 2010

Comments

#Comment by Simetrical (talk | contribs)   00:32, 10 October 2010

Note that the interface used by this code (Linker::link()) makes it impossible to output any attributes unescaped, since it accepts them only as a key-value array whose values it escapes before outputting. (You can still output the actual text of the link unescaped, unfortunately, since it's necessary to allow non-plaintext links.)

#Comment by Platonides (talk | contribs)   14:32, 10 October 2010

Yes, I noted it later. Still, these things make me a little bit nervous :)

Status & tagging log