From dd740a65dc010dc44318ae14e465166fbbb24da4 Mon Sep 17 00:00:00 2001 From: Marius Hoch Date: Thu, 15 Jan 2015 00:48:54 +0100 Subject: [PATCH] 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 --- includes/Linker.php | 4 ++-- tests/phpunit/includes/LinkerTest.php | 5 +++++ 2 files changed, 7 insertions(+), 2 deletions(-) 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]]', -- 2.20.1