From 366bb4a7de49b653faa1a12d282cd50bd3164fdd Mon Sep 17 00:00:00 2001 From: "Mark A. Hershberger" Date: Mon, 22 Feb 2010 03:07:28 +0000 Subject: [PATCH] follow up r53282 Recover the use of verifyExtension that was lost in r53282 --- includes/upload/UploadBase.php | 5 +++++ languages/messages/MessagesEn.php | 1 + maintenance/language/messages.inc | 1 + 3 files changed, 7 insertions(+) diff --git a/includes/upload/UploadBase.php b/includes/upload/UploadBase.php index ce4b66b6e9..5d955b361e 100644 --- a/includes/upload/UploadBase.php +++ b/includes/upload/UploadBase.php @@ -239,6 +239,11 @@ abstract class UploadBase { # check mime type, if desired global $wgVerifyMimeType; if ( $wgVerifyMimeType ) { + wfDebug ( "\n\nmime: <$mime> extension: <{$this->mFinalExtension}>\n\n"); + if ( !$this->verifyExtension( $mime, $this->mFinalExtension ) ) { + return array( 'filetype-mime-mismatch' ); + } + global $wgMimeTypeBlacklist; if ( $this->checkFileExtension( $mime, $wgMimeTypeBlacklist ) ) { return array( 'filetype-badmime', $mime ); diff --git a/languages/messages/MessagesEn.php b/languages/messages/MessagesEn.php index ea64f7e2df..dc1d6a6910 100644 --- a/languages/messages/MessagesEn.php +++ b/languages/messages/MessagesEn.php @@ -2040,6 +2040,7 @@ See the [[Special:NewFiles|gallery of new files]] for a more visual overview.', 'illegalfilename' => 'The filename "$1" contains characters that are not allowed in page titles. Please rename the file and try uploading it again.', 'badfilename' => 'File name has been changed to "$1".', +'filetype-mime-mismatch' => 'File extension does not match MIME type.', 'filetype-badmime' => 'Files of the MIME type "$1" are not allowed to be uploaded.', 'filetype-bad-ie-mime' => 'Cannot upload this file because Internet Explorer would detect it as "$1", which is a disallowed and potentially dangerous file type.', 'filetype-unwanted-type' => "'''\".\$1\"''' is an unwanted file type. diff --git a/maintenance/language/messages.inc b/maintenance/language/messages.inc index 098fbe42dd..3ffc2f2336 100644 --- a/maintenance/language/messages.inc +++ b/maintenance/language/messages.inc @@ -1203,6 +1203,7 @@ $wgMessageStructure = array( 'minlength1', 'illegalfilename', 'badfilename', + 'filetype-mime-mismatch', 'filetype-badmime', 'filetype-bad-ie-mime', 'filetype-unwanted-type', -- 2.20.1