|
|
|
@ -424,8 +424,15 @@ class OC_Helper { |
|
|
|
|
*/ |
|
|
|
|
static public function getMimetypeDetector() { |
|
|
|
|
if (!self::$mimetypeDetector) { |
|
|
|
|
$file = file_get_contents(OC::$SERVERROOT . '/config/mimetypemapping.json'); |
|
|
|
|
$mimetypemapping = get_object_vars(json_decode($file)); |
|
|
|
|
$dist = file_get_contents(OC::$SERVERROOT . '/config/mimetypemapping.dist.json'); |
|
|
|
|
$mimetypemapping = get_object_vars(json_decode($dist)); |
|
|
|
|
|
|
|
|
|
//Check if need to load custom mappings |
|
|
|
|
if (file_exists(OC::$SERVERROOT . '/config/mimetypemapping.json')) { |
|
|
|
|
$custom = file_get_contents(OC::$SERVERROOT . '/config/mimetypemapping.json'); |
|
|
|
|
$custom_mapping = get_object_vars(json_decode($custom)); |
|
|
|
|
$mimetypemapping = array_merge($mimetypemapping, $custom_mapping); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
self::$mimetypeDetector = new \OC\Files\Type\Detection(); |
|
|
|
|
self::$mimetypeDetector->registerTypeArray($mimetypemapping); |
|
|
|
|