Index: trunk/phase3/includes/specials/SpecialUploadStash.php |
— | — | @@ -129,16 +129,14 @@ |
130 | 130 | $thumbPart = strtok( '/' ); |
131 | 131 | $file = $this->stash->getFile( $fileName ); |
132 | 132 | 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 ); |
140 | 138 | |
141 | 139 | $handler = $file->getHandler(); |
142 | | - $params = $handler->parseParamString( $parts[0] ); |
| 140 | + $params = $handler->parseParamString( $paramString ); |
143 | 141 | return array( 'file' => $file, 'type' => $type, 'params' => $params ); |
144 | 142 | } |
145 | 143 | |