From: Andrew Garrett Date: Wed, 19 Jan 2011 01:10:53 +0000 (+0000) Subject: Revert r80544 -- need to handle the case in which there is an error X-Git-Tag: 1.31.0-rc.0~32478 X-Git-Url: http://git.cyclocoop.org/data/Fool?a=commitdiff_plain;h=e0cfef93f3add684cc02bd3a0854b21a5352b197;p=lhc%2Fweb%2Fwiklou.git Revert r80544 -- need to handle the case in which there is an error --- diff --git a/includes/specials/SpecialFilepath.php b/includes/specials/SpecialFilepath.php index cb3bb49a7b..46d340aecb 100644 --- a/includes/specials/SpecialFilepath.php +++ b/includes/specials/SpecialFilepath.php @@ -46,19 +46,21 @@ class SpecialFilepath extends SpecialPage { $this->showForm( $title ); } else { $file = wfFindFile( $title ); + if ( $file && $file->exists() ) { + // Default behaviour: Use the direct link to the file. + $url = $file->getURL(); $width = $wgRequest->getInt( 'width', -1 ); $height = $wgRequest->getInt( 'height', -1 ); if ( $width != -1 ) { + // If we can, and it's requested, + // change the URL to point to a thumbnail. $mto = $file->transform( array( 'width' => $width, 'height' => $height ) ); if ( $mto && !$mto->isError() ) { $url = $mto->getURL(); } - } else { - $url = $file->getURL(); } - $wgOut->redirect( $url ); } else { $wgOut->setStatusCode( 404 );