summaryrefslogtreecommitdiffstats
path: root/lib/public
diff options
context:
space:
mode:
authorFlorin Peter <github@florin-peter.de>2013-05-29 20:11:13 +0200
committerFlorin Peter <github@florin-peter.de>2013-05-29 20:11:13 +0200
commit353d19d183b00132204de8a1798aa7f9d9caa4d9 (patch)
tree57d0ce9970522956bb2a54648c4053061dd36047 /lib/public
parentc8d1cd224ddb7cd3c554d0a601e1215968817be4 (diff)
downloadnextcloud-server-353d19d183b00132204de8a1798aa7f9d9caa4d9.tar.gz
nextcloud-server-353d19d183b00132204de8a1798aa7f9d9caa4d9.zip
fixes if cache returns false
Diffstat (limited to 'lib/public')
-rw-r--r--lib/public/share.php22
1 files changed, 16 insertions, 6 deletions
diff --git a/lib/public/share.php b/lib/public/share.php
index bc0e3f15c53..9a24192b4c8 100644
--- a/lib/public/share.php
+++ b/lib/public/share.php
@@ -123,25 +123,31 @@ class Share {
return $path;
}
-
+
/**
* @brief Find which users can access a shared item
* @param $path to the file
* @param $user owner of the file
* @param include owner to the list of users with access to the file
* @return array
- * @note $path needs to be relative to user data dir, e.g. 'file.txt'
+ * @note $path needs to be relative to user data dir, e.g. 'file.txt'
* not '/admin/data/file.txt'
*/
public static function getUsersSharingFile($path, $user, $includeOwner = false) {
$shares = array();
$publicShare = false;
+ $source = '-1';
+ $cache = false;
+
$view = new \OC\Files\View('/' . $user . '/files/');
$meta = $view->getFileInfo(\OC_Filesystem::normalizePath($path));
- $source = $meta['fileid'];
- $cache = new \OC\Files\Cache\Cache($meta['storage']);
-
+
+ if($meta !== false) {
+ $source = $meta['fileid'];
+ $cache = new \OC\Files\Cache\Cache($meta['storage']);
+ }
+
while ($source !== '-1') {
// Fetch all shares of this file path from DB
@@ -206,7 +212,11 @@ class Share {
// let's get the parent for the next round
$meta = $cache->get((int)$source);
- $source = $meta['parent'];
+ if($meta !== false) {
+ $source = $meta['parent'];
+ } else {
+ $source = '-1';
+ }
}
// Include owner in list of users, if requested
if ($includeOwner) {