From: Florian Schmidt Date: Tue, 1 Aug 2017 20:43:51 +0000 (+0200) Subject: Fix not parsed message on Special:Import X-Git-Tag: 1.31.0-rc.0~2481^2 X-Git-Url: http://git.cyclocoop.org/%24action?a=commitdiff_plain;h=c5d63ff572132b256655b72ac95eb8d5a3416533;p=lhc%2Fweb%2Fwiklou.git Fix not parsed message on Special:Import If session data is lost between the transactions (read: the csrf token does not match), the error message contains some wiki markup as well as HTML. However, unfortunately, SpecialImport uses $out->wrapWikiMsg() in combination with an error message (with wiki markup and HTML) wrapped as a parameter of another message. This results in an escaped paramater and it is not parsed correctly, which leads in wiki markup send to the user. This change fixes that issue by parsing the message directly. Bug: T172114 Change-Id: If49a600173c44d098f25d6e2a9b87b7b7bf3ee2a --- diff --git a/includes/specials/SpecialImport.php b/includes/specials/SpecialImport.php index a827e89263..beb454d669 100644 --- a/includes/specials/SpecialImport.php +++ b/includes/specials/SpecialImport.php @@ -173,10 +173,8 @@ class SpecialImport extends SpecialPage { $out = $this->getOutput(); if ( !$source->isGood() ) { - $out->wrapWikiMsg( - "

\n$1\n

", - [ 'importfailed', $source->getWikiText() ] - ); + $out->addWikiText( "

\n" . + $this->msg( 'importfailed', $source->getWikiText() )->parse() . "\n

" ); } else { $importer = new WikiImporter( $source->value, $this->getConfig() ); if ( !is_null( $this->namespace ) ) { diff --git a/languages/i18n/en.json b/languages/i18n/en.json index 8c295b289d..4929f550e3 100644 --- a/languages/i18n/en.json +++ b/languages/i18n/en.json @@ -2741,7 +2741,7 @@ "import-nonewrevisions": "No revisions imported (all were either already present, or skipped due to errors).", "xml-error-string": "$1 at line $2, col $3 (byte $4): $5", "import-upload": "Upload XML data", - "import-token-mismatch": "Loss of session data.\n\nYou might have been logged out. Please verify that you're still logged in and try again.\nIf it still does not work, try [[Special:UserLogout|logging out]] and logging back in, and check that your browser allows cookies from this site.", + "import-token-mismatch": "Loss of session data.\n\nYou might have been logged out. '''Please verify that you're still logged in and try again'''.\nIf it still does not work, try [[Special:UserLogout|logging out]] and logging back in, and check that your browser allows cookies from this site.", "import-invalid-interwiki": "Cannot import from the specified wiki.", "import-error-edit": "Page \"$1\" was not imported because you are not allowed to edit it.", "import-error-create": "Page \"$1\" was not imported because you are not allowed to create it.",