Use accessor method, ping r110179
[lhc/web/wiklou.git] / includes / StreamFile.php
index dc70712..0de03c8 100644 (file)
@@ -74,10 +74,14 @@ class StreamFile {
                // 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' );
                }
 
@@ -111,12 +115,13 @@ class StreamFile {
        }
 
        /**
-        * 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, '.' );