From: Aaron Schulz Date: Wed, 10 Oct 2012 18:16:28 +0000 (-0700) Subject: Avoid thumb.php fatal for bad titles on private wikis. X-Git-Tag: 1.31.0-rc.0~22071 X-Git-Url: http://git.cyclocoop.org/%22.%28%24lien.?a=commitdiff_plain;h=42c0f35133b66580dc663543a6e07ad0524a5381;p=lhc%2Fweb%2Fwiklou.git Avoid thumb.php fatal for bad titles on private wikis. Change-Id: Id2c19d888989fdbaad6412aa9eb62bb22a75f241 --- diff --git a/thumb.php b/thumb.php index 068ec01700..362f304b62 100644 --- a/thumb.php +++ b/thumb.php @@ -153,6 +153,13 @@ function wfStreamThumb( array $params ) { $img = wfLocalFile( $fileName ); } + // Check the source file title + if ( !$img ) { + wfThumbError( 404, wfMessage( 'badtitletext' )->text() ); + wfProfileOut( __METHOD__ ); + return; + } + // Check permissions if there are read restrictions $varyHeader = array(); if ( !in_array( 'read', User::getGroupPermissions( array( '*' ) ), true ) ) { @@ -167,11 +174,6 @@ function wfStreamThumb( array $params ) { } // Check the source file storage path - if ( !$img ) { - wfThumbError( 404, wfMessage( 'badtitletext' )->text() ); - wfProfileOut( __METHOD__ ); - return; - } if ( !$img->exists() ) { wfThumbError( 404, 'The source file for the specified thumbnail does not exist.' ); wfProfileOut( __METHOD__ );