r82843 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r82842‎ | r82843 | r82844 >
Date:12:08, 26 February 2011
Author:btongminh
Status:ok (Comments)
Tags:
Comment:
(bug 27679) Broken embedded files with special characters are no longer double HTML escaped
Was a double escape in Linker::makeBrokenImageLinkObj. I checked the callers and other usages in the function and $prefix and $inside appear to be assumed HTML fragments
Added parser tests: Passed 622 of 624 tests (99.68%)... 2 tests failed! Those two tests already failed for me before this patch
Modified paths:
  • /trunk/phase3/RELEASE-NOTES (modified) (history)
  • /trunk/phase3/includes/Linker.php (modified) (history)
  • /trunk/phase3/tests/parser/parserTests.txt (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/Linker.php
@@ -686,10 +686,10 @@
687687 * Make a "broken" link to an image
688688 *
689689 * @param $title Title object
690 - * @param $text String: link label
 690+ * @param $text String: link label in unescaped text form
691691 * @param $query String: query string
692 - * @param $trail String: link trail
693 - * @param $prefix String: link prefix
 692+ * @param $trail String: link trail (HTML fragment)
 693+ * @param $prefix String: link prefix (HTML fragment)
694694 * @param $time Boolean: a file of a certain timestamp was requested
695695 * @return String
696696 */
@@ -716,7 +716,7 @@
717717 wfProfileOut( __METHOD__ );
718718 return '<a href="' . htmlspecialchars( $href ) . '" class="new" title="' .
719719 htmlspecialchars( $title->getPrefixedText(), ENT_QUOTES ) . '">' .
720 - htmlspecialchars( $prefix . $text . $inside, ENT_NOQUOTES ) . '</a>' . $trail;
 720+ "$prefix$text$inside</a>$trail";
721721 } else {
722722 wfProfileOut( __METHOD__ );
723723 return $this->linkKnown( $title, "$prefix$text$inside", array(), $query ) . $trail;
Index: trunk/phase3/RELEASE-NOTES
@@ -142,7 +142,10 @@
143143 * (bug 15905) Nostalgia skin could become more usable by including a Talk:
144144 link at the top of the page
145145 * (bug 27560) Search queries no longer fail in walloon language
 146+* (bug 27679) Broken embedded files with special characters longer double HTML
 147+ escaped
146148
 149+
147150 === API changes in 1.18 ===
148151 * (bug 26339) Throw warning when truncating an overlarge API result
149152 * (bug 14869) Add API module for accessing QueryPage-based special pages
Index: trunk/phase3/tests/parser/parserTests.txt
@@ -8422,6 +8422,28 @@
84238423 </p>
84248424 !! end
84258425
 8426+!! test
 8427+Special characters in embedded file links (bug 27679)
 8428+!! input
 8429+[[File:Contains & ampersand.jpg]]
 8430+[[File:Does not exist.jpg|Title with & ampersand]]
 8431+!! result
 8432+<p><a href="https://www.mediawiki.org/index.php?title=Special:Upload&amp;wpDestFile=Contains_%26_ampersand.jpg" class="new" title="File:Contains &amp; ampersand.jpg">File:Contains &amp; ampersand.jpg</a>
 8433+<a href="https://www.mediawiki.org/index.php?title=Special:Upload&amp;wpDestFile=Does_not_exist.jpg" class="new" title="File:Does not exist.jpg">Title with &amp; ampersand</a>
 8434+</p>
 8435+!! end
 8436+
 8437+!! test
 8438+Special characters in embedded file links (bug 27679)
 8439+!! input
 8440+[[File:Contains & ampersand.jpg]]
 8441+[[File:Does not exist.jpg|Title with & ampersand]]
 8442+!! result
 8443+<p><a href="https://www.mediawiki.org/index.php?title=Special:Upload&amp;wpDestFile=Contains_%26_ampersand.jpg" class="new" title="File:Contains &amp; ampersand.jpg">File:Contains &amp; ampersand.jpg</a>
 8444+<a href="https://www.mediawiki.org/index.php?title=Special:Upload&amp;wpDestFile=Does_not_exist.jpg" class="new" title="File:Does not exist.jpg">Title with &amp; ampersand</a>
 8445+</p>
 8446+!! end
 8447+
84268448 TODO:
84278449 more images
84288450 more tables

Follow-up revisions

RevisionCommit summaryAuthorDate
r82844Remove double parser test from r82843btongminh12:19, 26 February 2011
r82859Follow-up r82843: Fix RELEASE-NOTESbtongminh16:31, 26 February 2011

Comments

#Comment by Nikerabbit (talk | contribs)   15:17, 26 February 2011

Typo in release notes

Status & tagging log