]> source.dussan.org Git - nextcloud-server.git/commitdiff
Mimetype for sharing overview
authorVincent Petry <pvince81@owncloud.com>
Tue, 20 May 2014 11:11:06 +0000 (13:11 +0200)
committerVincent Petry <pvince81@owncloud.com>
Fri, 30 May 2014 08:06:29 +0000 (10:06 +0200)
apps/files_sharing/js/sharedfilelist.js
apps/files_sharing/lib/api.php

index f3a6d669760719a1872512bc9a7d3551d20d10b5..4508de47dcc70f94c3931f15e9f741905abf52c0 100644 (file)
                                        /* 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';
index 10b3f76db8f998b6f535d1c415ba8fa3041e6f4d..ff56c465b29a5cce3853b47880895335a606ae39 100644 (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());