// Check if the file is hidden
if ( $img->isDeleted( File::DELETED_FILE ) ) {
- wfThumbError( 404, "The source file '$fileName' does not exist." );
+ wfThumbErrorText( 404, "The source file '$fileName' does not exist." );
return;
}
if ( count( $varyHeader ) ) {
$response->header( 'Vary: ' . implode( ', ', $varyHeader ) );
}
+ $response->header( 'Content-Length: 0' );
return;
}
// If its not a redirect that has a target as a local file, give 404.
- wfThumbError( 404, "The source file '$fileName' does not exist." );
+ wfThumbErrorText( 404, "The source file '$fileName' does not exist." );
return;
} elseif ( $img->getPath() === false ) {
- wfThumbError( 500, "The source file '$fileName' is not locally accessible." );
+ wfThumbErrorText( 500, "The source file '$fileName' is not locally accessible." );
return;
}
}
return;
} else {
- wfThumbError( 404, "The given path of the specified thumbnail is incorrect;
+ wfThumbErrorText( 404, "The given path of the specified thumbnail is incorrect;
expected '" . $img->getThumbRel( $thumbName ) . "' but got '" .
rawurldecode( $rel404 ) . "'." );
return;
wfThumbError( 500, 'Could not stream the file' );
} else {
RequestContext::getMain()->getStats()->timing( 'media.thumbnail.stream', $streamtime );
- wfDebugLog( 'thumbnailaccess', time() . ' ' . $thumbPath . ' ' . ob_get_length() . ' Streamed ' );
}
return;
}
return null;
}
+
+/**
+ * Output a thumbnail generation error message
+ *
+ * @param int $status
+ * @param string $msg Plain text (will be html escaped)
+ * @return void
+ */
+function wfThumbErrorText( $status, $msgText ) {
+ return wfThumbError( $status, htmlspecialchars( $msgText ) );
+}
+
/**
* Output a thumbnail generation error message
*
* @param int $status
- * @param string $msg HTML
+ * @param string $msgHtml HTML
* @return void
*/
-function wfThumbError( $status, $msg ) {
+function wfThumbError( $status, $msgHtml ) {
global $wgShowHostnames;
header( 'Cache-Control: no-cache' );
<body>
<h1>Error generating thumbnail</h1>
<p>
-$msg
+$msgHtml
</p>
$debug
</body>