From: Bryan Tong Minh Date: Mon, 31 Jan 2011 18:07:44 +0000 (+0000) Subject: Follow-up r81209: Use the same param detection method as WebStore, so that thumbnails... X-Git-Tag: 1.31.0-rc.0~32286 X-Git-Url: http://git.cyclocoop.org/ecrire?a=commitdiff_plain;h=880ce57711780035f487513af2a739d4bcbe2575;p=lhc%2Fweb%2Fwiklou.git Follow-up r81209: Use the same param detection method as WebStore, so that thumbnails with different mimetypes than the original file are thumbnailed as well. --- diff --git a/includes/specials/SpecialUploadStash.php b/includes/specials/SpecialUploadStash.php index befc7812fb..48a41a5e69 100644 --- a/includes/specials/SpecialUploadStash.php +++ b/includes/specials/SpecialUploadStash.php @@ -129,16 +129,14 @@ class SpecialUploadStash extends UnlistedSpecialPage { $thumbPart = strtok( '/' ); $file = $this->stash->getFile( $fileName ); if ( $type === 'thumb' ) { - - $parts = explode( "-{$fileName}", $thumbPart ); - - if ( count( $parts ) != 2 || $parts[1] !== '' ) { - throw new UploadStashBadPathException( 'Invalid suffix' ); - } - + $srcNamePos = strrpos( $thumbPart, $fileName ); + if ( $srcNamePos === false || $srcNamePos < 1 ) { + throw new UploadStashBadPathException( 'Unrecognized thumb name' ); + } + $paramString = substr( $thumbPart, 0, $srcNamePos - 1 ); $handler = $file->getHandler(); - $params = $handler->parseParamString( $parts[0] ); + $params = $handler->parseParamString( $paramString ); return array( 'file' => $file, 'type' => $type, 'params' => $params ); }