Hoo man has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/185092

Change subject: Don't double escape in Linker::formatLinksInComment
......................................................................

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

Change-Id: Ie73796dcde4e0a096a6baa86a53245e6fe2b48b5
---
M includes/Linker.php
M tests/phpunit/includes/LinkerTest.php
2 files changed, 7 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/92/185092/1

diff --git a/includes/Linker.php b/includes/Linker.php
index 7840868..e6b17bc 100644
--- a/includes/Linker.php
+++ b/includes/Linker.php
@@ -1464,9 +1464,9 @@
 
                                                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 6341bf0..823c933 100644
--- a/tests/phpunit/includes/LinkerTest.php
+++ b/tests/phpunit/includes/LinkerTest.php
@@ -232,6 +232,11 @@
                                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]]',
                                'enwiki',

-- 
To view, visit https://gerrit.wikimedia.org/r/185092
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ie73796dcde4e0a096a6baa86a53245e6fe2b48b5
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Hoo man <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to