Indefero

Issue 385: Error when clicking on individual file in GIT source tree view -- /etc/mime.types not known on Mac OS X

Reported by Nikolaus Schaller, Jan 23, 2010

IDF looks for /etc/mime.types which is not available on Mac OS X.


PlufErrorHandler [No File, line 0]
▼ Args
Arg	Name	Value
0	$code	
2
1	$string	
file_get_contents(/etc/mime.types) [<a 
href='function.file-get-contents'>function.file-get-contents</a
>]: failed to open stream: No such file or directory
2	$file	
/Library/WebServer/Documents/mirror/projects.goldelico.com/indefero/s
rc/IDF/Views/Source.php
3	$line	
509
4	?	
Array
(
    [file] => Makefile
    [src] => /etc/mime.types
)
No src available
file_get_contents 
[/Library/WebServer/Documents/mirror/projects.goldelico.com/indefero/
src/IDF/Views/Source.php, line 509]
▼ Args
Arg	Name	Value
0	$filename	
/etc/mime.types
▼ Src
     * @param array  Mime type found or 'application/octet-stream', 
basename, extension
     */
    public static function getMimeType($file)
    {
        $src= Pluf::f('idf_mimetypes_db', '/etc/mime.types');
        $mimes = preg_split("/\015\012|\015|\012/", 
file_get_contents($src));
        $info = pathinfo($file);
        if (isset($info['extension'])) {
            foreach ($mimes as $mime) {
                if ('#' != substr($mime, 0, 1)) {
                    $elts = preg_split('/ |\t/', $mime, -1, 
PREG_SPLIT_NO_EMPTY);
IDF_Views_Source::getMimeType 
[/Library/WebServer/Documents/mirror/projects.goldelico.com/indefero/
src/IDF/Views/Source.php, line 460]
▼ Args
Arg	Name	Value
0	$file	
Makefile
▼ Src
     * @param IDF_Scm SCM object
     * @param array  Mime type found or 'application/octet-stream', 
basename, extension
     */
    public static function getRequestedFileMimeType($file_info, 
$commit, $scm)
    {
        $mime = self::getMimeType($file_info->file);
        if ('application/octet-stream' != $mime[0]) {
            return $mime;
        }
        return self::getMimeTypeFromContent($file_info->file,
                                            
$scm->getFile($file_info));

Comment 1 by Loïc d'Anterroches, Jan 25, 2010

Follow this tip to get it to work:
http://projects.ceondo.com/p/indefero/source/tree/master/INSTALL.mdte
xt#L153
Labels: Type:Support Type:Defect
Status: Fixed

Comment 2 by Nikolaus Schaller, Jan 25, 2010

Does not work or solve the problem.

There is no /etc/mime.types file on Mac OS X to copy anywhere...

Comment 3 by Mehdi Kabab, Jan 26, 2010

Hi,

Uses this config in your idf.php:

$cfg['idf_mimetypes_db'] = '/etc/apache2/mime.types';

(Mac OS X 10.5)

Comment 4 by Nikolaus Schaller, Jan 26, 2010

This one works! Thank you very much.

Comment 5 by Mehdi Kabab, Jan 26, 2010

For those who can't find the file, you can retrieve it from the 
Apache repository:

https://svn.apache.org/repos/asf/httpd/httpd/branches/1.3.x/conf/mime
.types

Created: 3 years 4 months ago by Nikolaus Schaller

Updated: 3 years 3 months ago

Status: Fixed

Followed by: 2 persons

Labels:
Priority:Medium
Type:Support