Handle missing namespace prefix in XML dumps more gracefully
[lhc/web/wiklou.git] / thumb.php
index 10c2419..c38b89c 100644 (file)
--- 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' ) ] );
                }
        }
 }