aboutsummaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorVincent Petry <pvince81@owncloud.com>2014-05-20 13:11:06 +0200
committerVincent Petry <pvince81@owncloud.com>2014-05-30 10:06:29 +0200
commit0879a63320430b71c832c2c9fc725f3d244c9526 (patch)
treee3a617c4e8ae288a536015097dd18cd4f52f9d4e /apps
parentef59c69dc822c9ff69c564c41e0dfdce142b9cdf (diff)
downloadnextcloud-server-0879a63320430b71c832c2c9fc725f3d244c9526.tar.gz
nextcloud-server-0879a63320430b71c832c2c9fc725f3d244c9526.zip
Mimetype for sharing overview
Diffstat (limited to 'apps')
-rw-r--r--apps/files_sharing/js/sharedfilelist.js3
-rw-r--r--apps/files_sharing/lib/api.php17
2 files changed, 16 insertions, 4 deletions
diff --git a/apps/files_sharing/js/sharedfilelist.js b/apps/files_sharing/js/sharedfilelist.js
index f3a6d669760..4508de47dcc 100644
--- a/apps/files_sharing/js/sharedfilelist.js
+++ b/apps/files_sharing/js/sharedfilelist.js
@@ -133,7 +133,8 @@
/* jshint camelcase: false */
var file = {
id: share.file_source,
- mtime: share.stime * 1000
+ mtime: share.stime * 1000,
+ mimetype: share.mimetype
};
if (share.item_type === 'folder') {
file.type = 'dir';
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());