r81262 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r81261‎ | r81262 | r81263 >
Date:18:07, 31 January 2011
Author:btongminh
Status:ok
Tags:
Comment:
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.
Modified paths:
  • /trunk/phase3/includes/specials/SpecialUploadStash.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/specials/SpecialUploadStash.php
@@ -129,16 +129,14 @@
130130 $thumbPart = strtok( '/' );
131131 $file = $this->stash->getFile( $fileName );
132132 if ( $type === 'thumb' ) {
133 -
134 - $parts = explode( "-{$fileName}", $thumbPart );
135 -
136 - if ( count( $parts ) != 2 || $parts[1] !== '' ) {
137 - throw new UploadStashBadPathException( 'Invalid suffix' );
138 - }
139 -
 133+ $srcNamePos = strrpos( $thumbPart, $fileName );
 134+ if ( $srcNamePos === false || $srcNamePos < 1 ) {
 135+ throw new UploadStashBadPathException( 'Unrecognized thumb name' );
 136+ }
 137+ $paramString = substr( $thumbPart, 0, $srcNamePos - 1 );
140138
141139 $handler = $file->getHandler();
142 - $params = $handler->parseParamString( $parts[0] );
 140+ $params = $handler->parseParamString( $paramString );
143141 return array( 'file' => $file, 'type' => $type, 'params' => $params );
144142 }
145143

Follow-up revisions

RevisionCommit summaryAuthorDate
r814111.17: MFT r81186, r81187, r81197, r81209, r81210, r81211, r81215, r81238, r81...catrope20:23, 2 February 2011

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r81209As per my comments on bug 27038 and my comments on r75906, use a /thumb and /...btongminh16:57, 30 January 2011

Status & tagging log