srchub

srchub Commit Details


Date:2014-12-20 19:18:04 (10 years 1 day ago)
Author:Natalie Adams
Branch:master
Commit:1f4586ec92f7e7231f9a6f56c43c368bfaa1db12
Parents: 5b2937151c687dccd3dc09a6aca3345259afef80
Message:Fixing issue 71

Changes:

File differences

indefero/src/IDF/FileUtil.php
142142
143143
144144
145
146
147
148
149
150
151
145152
146153
147154
148155
156
157
158
159
160
161
162
149163
150164
151165
*/
public static function getMimeTypeFromContent($file, $filedata)
{
// There is a bug/memory leak in finfo_buffer
// finfo_buffer works 99% of the time - so rather than
// replacing it with some complex mime check system - just create
// a list of extensions that we know
// And document the types best we can:
// po is a translation file in indefero - tried text/plain but the syntax highlight JS library didn't like it
$ext_hack = array("po" => "application/octet-stream");
$info = pathinfo($file);
$res = array('application/octet-stream',
$info['basename'],
isset($info['extension']) ? $info['extension'] : 'bin');
if (array_key_exists($info["extension"], $ext_hack))
{
$res[0] = $ext_hack[$info["extension"]];
return $res;
}
if (function_exists('finfo_open')) {
$finfo = finfo_open(FILEINFO_MIME);
$mime = finfo_buffer($finfo, $filedata);

Archive Download the corresponding diff file

Branches

Number of commits:
Page rendered in 0.06878s using 20 queries.