Don't double escape in Linker::formatLinksInComment
authorMarius Hoch <hoo@online.de>
Wed, 14 Jan 2015 23:48:54 +0000 (00:48 +0100)
committerUmherirrender <umherirrender_de.wp@web.de>
Thu, 15 Jan 2015 18:14:42 +0000 (18:14 +0000)
Affected both the linked text and the actual URL.

For an example please see the ukwiki link on:
https://www.mediawiki.org/wiki/Special:CentralAuth/Admin

Follow-Up: Ibdedf087f85046646450367cbf1811db578d8f4b
Change-Id: Ie73796dcde4e0a096a6baa86a53245e6fe2b48b5

includes/Linker.php
tests/phpunit/includes/LinkerTest.php

index 7840868..e6b17bc 100644 (file)
@@ -1464,9 +1464,9 @@ class Linker {
 
                                                if ( $wikiId !== null ) {
                                                        $thelink = Linker::makeExternalLink(
-                                                               WikiMap::getForeignURL( $wikiId, $target->getPrefixedURL() ),
+                                                               WikiMap::getForeignURL( $wikiId, $target->getFullText() ),
                                                                $linkText . $inside,
-                                                               true
+                                                               /* escape = */ false // Already escaped
                                                        ) . $trail;
                                                } else {
                                                        $thelink = Linker::link(
index 6341bf0..823c933 100644 (file)
@@ -231,6 +231,11 @@ class LinkerTest extends MediaWikiLangTestCase {
                                'foo bar [[Special:BlankPage]]',
                                null,
                        ),
+                       array(
+                               '<a class="external" rel="nofollow" href="//en.example.org/w/Foo%27bar">Foo\'bar</a>',
+                               "[[Foo'bar]]",
+                               'enwiki',
+                       ),
                        array(
                                'foo bar <a class="external" rel="nofollow" href="//en.example.org/w/Special:BlankPage">Special:BlankPage</a>',
                                'foo bar [[Special:BlankPage]]',