X-Git-Url: https://git.heureux-cyclage.org/?p=lhc%2Fweb%2Fwiklou.git;a=blobdiff_plain;f=thumb.php;h=c38b89c251a657607a21425dc73323de7aa03c87;hp=10c2419db1485ea209456614c59fc5b887ea9bb4;hb=7492975a28a451688950786a6b06b722d861d0ee;hpb=734ca2b4d2a1246fb0ea1e54b861ab423ab5e257 diff --git a/thumb.php b/thumb.php index 10c2419db1..c38b89c251 100644 --- a/thumb.php +++ b/thumb.php @@ -320,7 +320,7 @@ function wfStreamThumb( array $params ) { RequestContext::getMain()->getStats()->timing( 'media.thumbnail.stream', $streamtime ); } else { wfThumbError( 500, 'Could not stream the file', null, [ 'file' => $thumbName, - 'path' => $thumbPath, 'error' => $status->getWikiText() ] ); + 'path' => $thumbPath, 'error' => $status->getWikiText( false, false, 'en' ) ] ); } return; } @@ -341,6 +341,7 @@ function wfStreamThumb( array $params ) { // Check for thumbnail generation errors... $msg = wfMessage( 'thumbnail_error' ); $errorCode = 500; + if ( !$thumb ) { $errorMsg = $errorMsg ?: $msg->rawParams( 'File::transform() returned false' )->escaped(); if ( $errorMsg instanceof MessageSpecifier && @@ -350,6 +351,7 @@ function wfStreamThumb( array $params ) { } } elseif ( $thumb->isError() ) { $errorMsg = $thumb->getHtmlMsg(); + $errorCode = $thumb->getHttpStatusCode(); } elseif ( !$thumb->hasFile() ) { $errorMsg = $msg->rawParams( 'No path supplied in thumbnail object' )->escaped(); } elseif ( $thumb->fileIsSource() ) { @@ -366,7 +368,8 @@ function wfStreamThumb( array $params ) { $status = $thumb->streamFileWithStatus( $headers ); if ( !$status->isOK() ) { wfThumbError( 500, 'Could not stream the file', null, [ - 'file' => $thumbName, 'path' => $thumbPath, 'error' => $status->getWikiText() ] ); + 'file' => $thumbName, 'path' => $thumbPath, + 'error' => $status->getWikiText( false, false, 'en' ) ] ); } } }