]> source.dussan.org Git - nextcloud-server.git/commitdiff
set share id to 'unknown' if we can't retrive one
authorBjoern Schiessle <schiessle@owncloud.com>
Thu, 19 Sep 2013 14:52:44 +0000 (16:52 +0200)
committerBjoern Schiessle <schiessle@owncloud.com>
Thu, 19 Sep 2013 14:52:44 +0000 (16:52 +0200)
apps/files_sharing/lib/api.php

index 06da492ba155eae7db0feccb0eeda180fdbdbdd8..3aa87b6e1d1d797be9bc459eb538b16158c4dd64 100644 (file)
@@ -182,25 +182,24 @@ class Api {
                }
 
                if ($token) {
-                       $data = null;
+                       $data = array();
+                       $data['id'] = 'unknown';
                        $shares = \OCP\Share::getItemShared('file', $itemSource);
                        if(is_string($token)) { //public link share
                                foreach ($shares as $share) {
                                        if ($share['token'] === $token) {
-                                               $shareId = $share['id'];
+                                               $data['id'] = $share['id'];
                                                break;
                                        }
                                }
                                $url = \OCP\Util::linkToPublic('files&t='.$token);
-                               $data = array('url' => $url, // '&' gets encoded to $amp;
-                                       'token' => $token,
-                                       'id' => $shareId);
+                               $data['url'] = $url; // '&' gets encoded to $amp;
+                               $data['token'] = $token;
 
                        } else {
                                foreach ($shares as $share) {
                                        if ($share['share_with'] === $shareWith && $share['share_type'] === $shareType) {
-                                               $shareId = $share['id'];
-                                               $data = array('id' => $shareId);
+                                               $data['id'] = $share['id'];
                                                break;
                                        }
                                }