]> source.dussan.org Git - nextcloud-server.git/commitdiff
Fixed warning when file_target is not set
authorVincent Petry <pvince81@owncloud.com>
Fri, 30 May 2014 10:35:04 +0000 (12:35 +0200)
committerVincent Petry <pvince81@owncloud.com>
Fri, 30 May 2014 10:35:04 +0000 (12:35 +0200)
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

index ff56c465b29a5cce3853b47880895335a606ae39..dc4e5cf6c49f03ad1b69782f49fcd92cf4c5ddf0 100644 (file)
@@ -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;