// Cancel output buffering and gzipping if set
wfResetOutputBuffers();
- $type = self::getType( $path );
+ $type = self::contentTypeFromPath( $path );
if ( $type && $type != 'unknown/unknown' ) {
header( "Content-type: $type" );
} else {
+ // Send a content type which is not known to Internet Explorer, to
+ // avoid triggering IE's content type detection. Sending a standard
+ // unknown content type here essentially gives IE license to apply
+ // whatever content type it likes.
header( 'Content-type: application/x-wiki' );
}
}
/**
- * Determine the filetype we're dealing with
+ * Determine the file type of a file based on the path
+ *
* @param $filename string Storage path or file system path
* @param $safe bool Whether to do retroactive upload blacklist checks
* @return null|string
*/
- protected static function getType( $filename, $safe = true ) {
+ public static function contentTypeFromPath( $filename, $safe = true ) {
global $wgTrivialMimeDetection;
$ext = strrchr( $filename, '.' );