From: Marius Hoch Date: Wed, 14 Jan 2015 23:48:54 +0000 (+0100) Subject: Don't double escape in Linker::formatLinksInComment X-Git-Tag: 1.31.0-rc.0~12518^2 X-Git-Url: https://git.cyclocoop.org/%27.%24link.%27?a=commitdiff_plain;h=dd740a65dc010dc44318ae14e465166fbbb24da4;p=lhc%2Fweb%2Fwiklou.git Don't double escape in Linker::formatLinksInComment 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 --- diff --git a/includes/Linker.php b/includes/Linker.php index 78408680b6..e6b17bc8a1 100644 --- a/includes/Linker.php +++ b/includes/Linker.php @@ -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( diff --git a/tests/phpunit/includes/LinkerTest.php b/tests/phpunit/includes/LinkerTest.php index 6341bf0896..823c9330a6 100644 --- a/tests/phpunit/includes/LinkerTest.php +++ b/tests/phpunit/includes/LinkerTest.php @@ -231,6 +231,11 @@ class LinkerTest extends MediaWikiLangTestCase { 'foo bar [[Special:BlankPage]]', null, ), + array( + 'Foo\'bar', + "[[Foo'bar]]", + 'enwiki', + ), array( 'foo bar Special:BlankPage', 'foo bar [[Special:BlankPage]]',