From 880ce57711780035f487513af2a739d4bcbe2575 Mon Sep 17 00:00:00 2001 From: Bryan Tong Minh Date: Mon, 31 Jan 2011 18:07:44 +0000 Subject: [PATCH] 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. --- includes/specials/SpecialUploadStash.php | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) 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 ); } -- 2.20.1