- $disposition = $img->getThumbDisposition( $thumbName );
- $headers[] = "Content-Disposition: $disposition";
-
- // Stream the file if it exists already...
- try {
- $thumbName2 = $img->thumbName( $params, File::THUMB_FULL_NAME ); // b/c; "long" style
- // For 404 handled thumbnails, we only use the the base name of the URI
- // for the thumb params and the parent directory for the source file name.
- // Check that the zone relative path matches up so squid caches won't pick
- // up thumbs that would not be purged on source file deletion (bug 34231).
- if ( isset( $params['rel404'] ) ) { // thumbnail was handled via 404
- if ( urldecode( $params['rel404'] ) === $img->getThumbRel( $thumbName ) ) {
- // Request for the canonical thumbnail name
- } elseif ( urldecode( $params['rel404'] ) === $img->getThumbRel( $thumbName2 ) ) {
- // Request for the "long" thumbnail name; redirect to canonical name
- $response = RequestContext::getMain()->getRequest()->response();
- $response->header( "HTTP/1.1 301 " . HttpStatus::getMessage( 301 ) );
- $response->header( 'Location: ' . wfExpandUrl( $img->getThumbUrl( $thumbName ), PROTO_CURRENT ) );
- $response->header( 'Expires: ' .
- gmdate( 'D, d M Y H:i:s', time() + 7*86400 ) . ' GMT' );
- if ( $wgVaryOnXFP ) {
- $varyHeader[] = 'X-Forwarded-Proto';
- }
- if ( count( $varyHeader ) ) {
- $response->header( 'Vary: ' . implode( ', ', $varyHeader ) );
- }
- wfProfileOut( __METHOD__ );
- return;
- } else {
- wfThumbError( 404, 'The given path of the specified thumbnail is incorrect.' );
- wfProfileOut( __METHOD__ );
- return;
+ // For 404 handled thumbnails, we only use the the base name of the URI
+ // for the thumb params and the parent directory for the source file name.
+ // Check that the zone relative path matches up so squid caches won't pick
+ // up thumbs that would not be purged on source file deletion (bug 34231).
+ if ( isset( $params['rel404'] ) ) { // thumbnail was handled via 404
+ if ( rawurldecode( $params['rel404'] ) === $img->getThumbRel( $thumbName ) ) {
+ // Request for the canonical thumbnail name
+ } elseif ( rawurldecode( $params['rel404'] ) === $img->getThumbRel( $thumbName2 ) ) {
+ // Request for the "long" thumbnail name; redirect to canonical name
+ $response = RequestContext::getMain()->getRequest()->response();
+ $response->header( "HTTP/1.1 301 " . HttpStatus::getMessage( 301 ) );
+ $response->header( 'Location: ' .
+ wfExpandUrl( $img->getThumbUrl( $thumbName ), PROTO_CURRENT ) );
+ $response->header( 'Expires: ' .
+ gmdate( 'D, d M Y H:i:s', time() + 7*86400 ) . ' GMT' );
+ if ( $wgVaryOnXFP ) {
+ $varyHeader[] = 'X-Forwarded-Proto';