summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorThomas Müller <thomas.mueller@tmit.eu>2015-12-18 10:15:33 +0100
committerThomas Müller <thomas.mueller@tmit.eu>2015-12-18 10:15:33 +0100
commit9e97bef935775b026410e54f5f1c549544186036 (patch)
treee11743ecb11d7375d1d1bae240a5671648d4fb12 /apps
parent551e553bf4f6cda7c559429cc6f0c40d3eb15d0b (diff)
parentecdf88e41b898889fe8e05bb9c05415dd6b03a95 (diff)
downloadnextcloud-server-9e97bef935775b026410e54f5f1c549544186036.tar.gz
nextcloud-server-9e97bef935775b026410e54f5f1c549544186036.zip
Merge pull request #21268 from owncloud/cleanup-OC_Helper-getFileNameMimeType
Use proper public API for OC_Helper::getFileNameMimeType
Diffstat (limited to 'apps')
-rw-r--r--apps/files_sharing/api/local.php6
-rw-r--r--apps/files_trashbin/ajax/preview.php2
-rw-r--r--apps/files_trashbin/lib/helper.php2
-rw-r--r--apps/files_versions/ajax/preview.php2
4 files changed, 7 insertions, 5 deletions
diff --git a/apps/files_sharing/api/local.php b/apps/files_sharing/api/local.php
index aaafafb269f..5b2f2e06e75 100644
--- a/apps/files_sharing/api/local.php
+++ b/apps/files_sharing/api/local.php
@@ -64,9 +64,10 @@ class Local {
if ($shares === false) {
return new \OC_OCS_Result(null, 404, 'could not get shares');
} else {
+ $mimetypeDetector = \OC::$server->getMimeTypeDetector();
foreach ($shares as &$share) {
if ($share['item_type'] === 'file' && isset($share['path'])) {
- $share['mimetype'] = \OC_Helper::getFileNameMimeType($share['path']);
+ $share['mimetype'] = $mimetypeDetector->detectPath($share['path']);
if (\OC::$server->getPreviewManager()->isMimeSupported($share['mimetype'])) {
$share['isPreviewAvailable'] = true;
}
@@ -227,9 +228,10 @@ class Local {
private static function getFilesSharedWithMe() {
try {
$shares = \OCP\Share::getItemsSharedWith('file');
+ $mimetypeDetector = \OC::$server->getMimeTypeDetector();
foreach ($shares as &$share) {
if ($share['item_type'] === 'file') {
- $share['mimetype'] = \OC_Helper::getFileNameMimeType($share['file_target']);
+ $share['mimetype'] = $mimetypeDetector->detectPath($share['file_target']);
if (\OC::$server->getPreviewManager()->isMimeSupported($share['mimetype'])) {
$share['isPreviewAvailable'] = true;
}
diff --git a/apps/files_trashbin/ajax/preview.php b/apps/files_trashbin/ajax/preview.php
index 49d6d93f574..ecb4971253f 100644
--- a/apps/files_trashbin/ajax/preview.php
+++ b/apps/files_trashbin/ajax/preview.php
@@ -62,7 +62,7 @@ try{
$fileName = substr($fileName, 0, $i);
}
}
- $mimetype = \OC_Helper::getFileNameMimeType($fileName);
+ $mimetype = \OC::$server->getMimeTypeDetector()->detectPath($fileName);
}
$preview->setMimetype($mimetype);
$preview->setMaxX($maxX);
diff --git a/apps/files_trashbin/lib/helper.php b/apps/files_trashbin/lib/helper.php
index d14e97285c5..0ccf15cd2bc 100644
--- a/apps/files_trashbin/lib/helper.php
+++ b/apps/files_trashbin/lib/helper.php
@@ -87,7 +87,7 @@ class Helper
$i = array(
'name' => $id,
'mtime' => $timestamp,
- 'mimetype' => $view->is_dir($dir . '/' . $entryName) ? 'httpd/unix-directory' : \OC_Helper::getFileNameMimeType($id),
+ 'mimetype' => $view->is_dir($dir . '/' . $entryName) ? 'httpd/unix-directory' : \OC::$server->getMimeTypeDetector()->detectPath($id),
'type' => $view->is_dir($dir . '/' . $entryName) ? 'dir' : 'file',
'directory' => ($dir === '/') ? '' : $dir,
'size' => $size,
diff --git a/apps/files_versions/ajax/preview.php b/apps/files_versions/ajax/preview.php
index 0da518f3eaa..f21911abc9b 100644
--- a/apps/files_versions/ajax/preview.php
+++ b/apps/files_versions/ajax/preview.php
@@ -48,7 +48,7 @@ if($maxX === 0 || $maxY === 0) {
try {
list($user, $file) = \OCA\Files_Versions\Storage::getUidAndFilename($file);
$preview = new \OC\Preview($user, 'files_versions', $file.'.v'.$version);
- $mimetype = \OC_Helper::getFileNameMimeType($file);
+ $mimetype = \OC::$server->getMimeTypeDetector()->detectPath($file);
$preview->setMimetype($mimetype);
$preview->setMaxX($maxX);
$preview->setMaxY($maxY);