Mimetype for sharing overview

This commit is contained in:
Vincent Petry 2014-05-20 13:11:06 +02:00
parent ef59c69dc8
commit 0879a63320
2 changed files with 16 additions and 4 deletions

View File

@ -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';

View File

@ -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());