[Pkg-owncloud-commits] [owncloud] 160/199: Mimetype for sharing overview

David Prévot taffit at moszumanska.debian.org
Sun Jun 1 18:53:21 UTC 2014


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to branch master
in repository owncloud.

commit 0879a63320430b71c832c2c9fc725f3d244c9526
Author: Vincent Petry <pvince81 at owncloud.com>
Date:   Tue May 20 13:11:06 2014 +0200

    Mimetype for sharing overview
---
 apps/files_sharing/js/sharedfilelist.js |  3 ++-
 apps/files_sharing/lib/api.php          | 17 ++++++++++++++---
 2 files changed, 16 insertions(+), 4 deletions(-)

diff --git a/apps/files_sharing/js/sharedfilelist.js b/apps/files_sharing/js/sharedfilelist.js
index f3a6d66..4508de4 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 10b3f76..ff56c46 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());

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud.git



More information about the Pkg-owncloud-commits mailing list