From 7fac2b62e954b0f8a693516da1151c97efa2ee99 Mon Sep 17 00:00:00 2001 From: Vincent Petry Date: Fri, 30 May 2014 12:35:04 +0200 Subject: Fixed warning when file_target is not set In some cases (like in the unit tests) "file_target" is not set yet whenever the target file system hasn't been mounted yet. --- apps/files_sharing/lib/api.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/apps/files_sharing/lib/api.php b/apps/files_sharing/lib/api.php index ff56c465b29..dc4e5cf6c49 100644 --- a/apps/files_sharing/lib/api.php +++ b/apps/files_sharing/lib/api.php @@ -58,7 +58,9 @@ class Api { return new \OC_OCS_Result(null, 404, 'could not get shares'); } else { foreach ($shares as &$share) { - if ($share['item_type'] === 'file') { + // file_target might not be set if the target user hasn't mounted + // the filesystem yet + if ($share['item_type'] === 'file' && isset($share['file_target'])) { $share['mimetype'] = \OC_Helper::getFileNameMimeType($share['file_target']); } $newShares[] = $share; -- cgit v1.2.3