Merge "Linker: Do not localize links to other wikis in comments"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Thu, 6 Jul 2017 02:08:02 +0000 (02:08 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Thu, 6 Jul 2017 02:08:02 +0000 (02:08 +0000)
1  2 
includes/Linker.php
tests/phpunit/includes/LinkerTest.php

diff --combined includes/Linker.php
@@@ -1331,7 -1331,10 +1331,10 @@@ class Linker 
                        $link = Linker::makeExternalLink(
                                WikiMap::getForeignURL(
                                        $wikiId,
-                                       $title->getPrefixedText(),
+                                       $title->getNamespace() === 0
+                                               ? $title->getDBkey()
+                                               : MWNamespace::getCanonicalName( $title->getNamespace() ) . ':'
+                                                       . $title->getDBkey(),
                                        $title->getFragment()
                                ),
                                $text,
         * @return string HTML output
         */
        public static function formatHiddenCategories( $hiddencats ) {
 -
                $outText = '';
                if ( count( $hiddencats ) > 0 ) {
                        # Construct the HTML
@@@ -265,6 -265,7 +265,6 @@@ class LinkerTest extends MediaWikiLangT
         * @dataProvider provideCasesForFormatLinksInComment
         */
        public function testFormatLinksInComment( $expected, $input, $wiki ) {
 -
                $conf = new SiteConfiguration();
                $conf->settings = [
                        'wgServer' => [
                                'foo bar [[Special:BlankPage]]',
                                'enwiki',
                        ],
+                       [
+                               'foo bar <a class="external" rel="nofollow" href="//en.example.org/w/File:Example">Image:Example</a>',
+                               'foo bar [[Image:Example]]',
+                               'enwiki',
+                       ],
                ];
                // @codingStandardsIgnoreEnd
        }