From 17b5bcb24f15d5b22185a48a3f7854e713b47747 Mon Sep 17 00:00:00 2001 From: Michael Gapczynski Date: Sun, 24 Jul 2011 14:38:01 -0400 Subject: [PATCH] Bug fixes for unshare() and opendir(), thanks darkh --- apps/files_sharing/lib_share.php | 2 +- apps/files_sharing/sharedstorage.php | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/apps/files_sharing/lib_share.php b/apps/files_sharing/lib_share.php index 6e43e203b2..44babc73a7 100644 --- a/apps/files_sharing/lib_share.php +++ b/apps/files_sharing/lib_share.php @@ -246,7 +246,7 @@ class OC_SHARE { * @param $uid_shared_with Array of users to unshare the item from */ public static function unshare($source, $uid_shared_with) { - $query = OC_DB::prepare("DELETE FROM *PREFIX*sharing WHERE source SUBSTR(source, 1, ?) = ? AND uid_shared_with = ? AND uid_owner = ?"); + $query = OC_DB::prepare("DELETE FROM *PREFIX*sharing WHERE SUBSTR(source, 1, ?) = ? AND uid_shared_with = ? AND uid_owner = ?"); foreach ($uid_shared_with as $uid) { $query->execute(array(strlen($source), $source, $uid, OC_USER::getUser())); } diff --git a/apps/files_sharing/sharedstorage.php b/apps/files_sharing/sharedstorage.php index c26423594f..8efccbc769 100644 --- a/apps/files_sharing/sharedstorage.php +++ b/apps/files_sharing/sharedstorage.php @@ -77,6 +77,9 @@ class OC_FILESTORAGE_SHARED extends OC_FILESTORAGE { global $FAKEDIRS; $path = $this->datadir.$path; $sharedItems = OC_SHARE::getItemsInFolder($path); + if (empty($sharedItems)) { + return false; + } foreach ($sharedItems as $item) { // If item is in the root of the shared storage provider add it to the fakedirs if (dirname($item['target'])."/" == $path) {