diff options
author | Bjoern Schiessle <schiessle@owncloud.com> | 2013-09-19 16:52:44 +0200 |
---|---|---|
committer | Bjoern Schiessle <schiessle@owncloud.com> | 2013-09-19 16:52:44 +0200 |
commit | 39920955f25f7b7f04395324b886d361725436ed (patch) | |
tree | 63a61a39845756faadafe430ba7da2f53bba2564 /apps | |
parent | c9f1538c1f5d9f950da77c869d16b3dfec8e46d8 (diff) | |
download | nextcloud-server-39920955f25f7b7f04395324b886d361725436ed.tar.gz nextcloud-server-39920955f25f7b7f04395324b886d361725436ed.zip |
set share id to 'unknown' if we can't retrive one
Diffstat (limited to 'apps')
-rw-r--r-- | apps/files_sharing/lib/api.php | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/apps/files_sharing/lib/api.php b/apps/files_sharing/lib/api.php index 06da492ba15..3aa87b6e1d1 100644 --- a/apps/files_sharing/lib/api.php +++ b/apps/files_sharing/lib/api.php @@ -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; } } |