From e0cfef93f3add684cc02bd3a0854b21a5352b197 Mon Sep 17 00:00:00 2001 From: Andrew Garrett Date: Wed, 19 Jan 2011 01:10:53 +0000 Subject: [PATCH] Revert r80544 -- need to handle the case in which there is an error --- includes/specials/SpecialFilepath.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) 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 ); -- 2.20.1