$stat['size'] = filesize($tmpFile);
$stat['mtime'] = $mTime;
$stat['storage_mtime'] = $mTime;
- $stat['mimetype'] = \OC_Helper::getMimeType($tmpFile);
+ $stat['mimetype'] = \OC::$server->getMimeTypeDetector()->detect($tmpFile);
$stat['etag'] = $this->getETag($path);
$fileId = $this->getCache()->put($path, $stat);
}
//detect the archive type
- $mime=OC_Helper::getMimeType($path);
+ $mime = \OC::$server->getMimeTypeDetector()->detect($path);
if ($mime !=='application/zip' && $mime !== 'application/x-gzip' && $mime !== 'application/x-bzip2') {
throw new \Exception($l->t("Archives of type %s are not supported", array($mime)));
}
];
}
- function testGetMimeType() {
- $dir=OC::$SERVERROOT.'/tests/data';
- $result = OC_Helper::getMimeType($dir."/");
- $expected = 'httpd/unix-directory';
- $this->assertEquals($result, $expected);
-
- $result = OC_Helper::getMimeType($dir."/data.tar.gz");
- $expected = 'application/x-gzip';
- $this->assertEquals($result, $expected);
-
- $result = OC_Helper::getMimeType($dir."/data.zip");
- $expected = 'application/zip';
- $this->assertEquals($result, $expected);
-
- $result = OC_Helper::getMimeType($dir."/desktopapp.svg");
- $expected = 'image/svg+xml';
- $this->assertEquals($result, $expected);
-
- $result = OC_Helper::getMimeType($dir."/desktopapp.png");
- $expected = 'image/png';
- $this->assertEquals($result, $expected);
- }
-
function testGetSecureMimeType() {
$dir=OC::$SERVERROOT.'/tests/data';