diff options
author | Vincent Petry <pvince81@owncloud.com> | 2014-05-20 13:11:06 +0200 |
---|---|---|
committer | Vincent Petry <pvince81@owncloud.com> | 2014-05-30 10:06:29 +0200 |
commit | 0879a63320430b71c832c2c9fc725f3d244c9526 (patch) | |
tree | e3a617c4e8ae288a536015097dd18cd4f52f9d4e /apps/files_sharing/lib/api.php | |
parent | ef59c69dc822c9ff69c564c41e0dfdce142b9cdf (diff) | |
download | nextcloud-server-0879a63320430b71c832c2c9fc725f3d244c9526.tar.gz nextcloud-server-0879a63320430b71c832c2c9fc725f3d244c9526.zip |
Mimetype for sharing overview
Diffstat (limited to 'apps/files_sharing/lib/api.php')
-rw-r--r-- | apps/files_sharing/lib/api.php | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/apps/files_sharing/lib/api.php b/apps/files_sharing/lib/api.php index 10b3f76db8f..ff56c465b29 100644 --- a/apps/files_sharing/lib/api.php +++ b/apps/files_sharing/lib/api.php @@ -52,12 +52,18 @@ class Api { return self::collectShares($params); } - $share = \OCP\Share::getItemShared('file', null); + $shares = \OCP\Share::getItemShared('file', null); - if ($share === false) { + if ($shares === false) { return new \OC_OCS_Result(null, 404, 'could not get shares'); } else { - return new \OC_OCS_Result($share); + foreach ($shares as &$share) { + if ($share['item_type'] === 'file') { + $share['mimetype'] = \OC_Helper::getFileNameMimeType($share['file_target']); + } + $newShares[] = $share; + } + return new \OC_OCS_Result($shares); } } @@ -205,6 +211,11 @@ class Api { private static function getFilesSharedWithMe() { try { $shares = \OCP\Share::getItemsSharedWith('file'); + foreach ($shares as &$share) { + if ($share['item_type'] === 'file') { + $share['mimetype'] = \OC_Helper::getFileNameMimeType($share['file_target']); + } + } $result = new \OC_OCS_Result($shares); } catch (\Exception $e) { $result = new \OC_OCS_Result(null, 403, $e->getMessage()); |