jenkins-bot has submitted this change and it was merged. Change subject: Moved the XML doctype out of a system message. ......................................................................
Moved the XML doctype out of a system message. Addresses translatewiki support request: https://translatewiki.net/wiki/Thread:Support/About_MediaWiki:Gwtoolset-unaccepted-mime-type-for-xml/he In order to allow the <code> HTML tags, I switched the GWTException use of GWToolset\Utils->sanitizeString to Sanitizer::removeHTMLtags as suggested by Siebrand. Change-Id: Ib7ef403c6114793874449231eb6b998002e3d029 --- M i18n/en.json M includes/GWTException.php M includes/Helpers/FileChecks.php 3 files changed, 4 insertions(+), 3 deletions(-) Approvals: Amire80: Looks good to me, approved Siebrand: Looks good to me, but someone else must approve jenkins-bot: Verified diff --git a/i18n/en.json b/i18n/en.json index cb05c29..5abc1e9 100644 --- a/i18n/en.json +++ b/i18n/en.json @@ -80,7 +80,7 @@ "gwtoolset-unaccepted-extension": "The file source does not contain an accepted file extension.", "gwtoolset-unaccepted-extension-specific": "The file source has an unaccepted file extension \".$1\".", "gwtoolset-unaccepted-mime-type": "The uploaded file is interpreted as having the MIME type \"$1\", which is not an accepted MIME type.", - "gwtoolset-unaccepted-mime-type-for-xml": "The uploaded file has the MIME type \"$1\", which is not an accepted. Does the XML file have an XML declaration at the top of the file?\n\n<?xml version=\"1.0\" encoding=\"UTF-8\"?>", + "gwtoolset-unaccepted-mime-type-for-xml": "The uploaded file has the MIME type <code dir=\"ltr\">$1</code>, which is not accepted.<br />Does the XML file have an XML declaration, <code dir=\"ltr\">$2</code>, at the top of the file?", "gwtoolset-back-text-link": "← go back to the form", "gwtoolset-back-text": "Press the browser back button to go back to the form.", "gwtoolset-file-interpretation-error": "There was a problem processing the metadata file.", diff --git a/includes/GWTException.php b/includes/GWTException.php index 0ebffda..8875c82 100644 --- a/includes/GWTException.php +++ b/includes/GWTException.php @@ -9,6 +9,7 @@ namespace GWToolset; use Exception; +use Sanitizer; class GWTException extends Exception { @@ -48,7 +49,7 @@ } else if ( strpos( $message, 'gwtoolset-' ) !== false ) { $result .= wfMessage( $message )->parse(); } else { - $result = Utils::sanitizeString( $message ); + $result = Sanitizer::removeHTMLtags( $message ); } return $result; diff --git a/includes/Helpers/FileChecks.php b/includes/Helpers/FileChecks.php index ac56db2..1e2cc62 100644 --- a/includes/Helpers/FileChecks.php +++ b/includes/Helpers/FileChecks.php @@ -185,7 +185,7 @@ public static function isAcceptedMimeType( File $File, array $accepted_mime_types = array() ) { if ( !in_array( $File->mime_type, $accepted_mime_types ) ) { if ( self::$current_extension === 'xml' ) { - return Status::newFatal( 'gwtoolset-unaccepted-mime-type-for-xml', Utils::sanitizeString( $File->mime_type ) ); + return Status::newFatal( 'gwtoolset-unaccepted-mime-type-for-xml', Utils::sanitizeString( $File->mime_type ), '<?xml version="1.0" encoding="UTF-8"?>' ); } else { return Status::newFatal( 'gwtoolset-unaccepted-mime-type', Utils::sanitizeString( $File->mime_type ) ); } -- To view, visit https://gerrit.wikimedia.org/r/184333 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: Ib7ef403c6114793874449231eb6b998002e3d029 Gerrit-PatchSet: 3 Gerrit-Project: mediawiki/extensions/GWToolset Gerrit-Branch: master Gerrit-Owner: Dan-nl <[email protected]> Gerrit-Reviewer: Amire80 <[email protected]> Gerrit-Reviewer: Dan-nl <[email protected]> Gerrit-Reviewer: Nikerabbit <[email protected]> Gerrit-Reviewer: Siebrand <[email protected]> Gerrit-Reviewer: jenkins-bot <> _______________________________________________ MediaWiki-commits mailing list [email protected] https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
