]> source.dussan.org Git - nextcloud-server.git/commitdiff
if the files doesn't exist yet we start with the parent to search for shares
authorBjoern Schiessle <schiessle@owncloud.com>
Thu, 5 Sep 2013 08:08:13 +0000 (10:08 +0200)
committerBjoern Schiessle <schiessle@owncloud.com>
Fri, 6 Sep 2013 14:07:07 +0000 (16:07 +0200)
lib/public/share.php

index fe996dbe2665f47d4891e285f075e653a72a23cf..06d67ab4e0a129371c5dd734e6b93ecd97d52635 100644 (file)
@@ -134,19 +134,25 @@ class Share {
        *       not '/admin/data/file.txt'
        */
        public static function getUsersSharingFile($path, $user, $includeOwner = false) {
-
+               error_log("getuser sharing files for: " . $path . " and " . $user);
                $shares = array();
                $publicShare = false;
                $source = -1;
                $cache = false;
 
-               $view = new \OC\Files\View('/' . $user . '/files/');
-               $meta = $view->getFileInfo(\OC\Files\Filesystem::normalizePath($path));
+               $view = new \OC\Files\View('/' . $user . '/files');
+               if ($view->file_exists($path)) {
+                       $meta = $view->getFileInfo($path);
+               } else {
+                       // if the file doesn't exists yet we start with the parent folder
+                       $meta = $view->getFileInfo(dirname($path));
+               }
 
                if($meta !== false) {
+                       error_log("source: " . $meta['fileid']);
                        $source = $meta['fileid'];
                        $cache = new \OC\Files\Cache\Cache($meta['storage']);
-               }
+               } else error_log("no source");
 
                while ($source !== -1) {
 
@@ -165,6 +171,7 @@ class Share {
                                \OCP\Util::writeLog('OCP\Share', \OC_DB::getErrorMessage($result), \OC_Log::ERROR);
                        } else {
                                while ($row = $result->fetchRow()) {
+                                       error_log("add user: " . $row['share_with']);
                                        $shares[] = $row['share_with'];
                                }
                        }
@@ -184,6 +191,7 @@ class Share {
                                \OCP\Util::writeLog('OCP\Share', \OC_DB::getErrorMessage($result), \OC_Log::ERROR);
                        } else {
                                while ($row = $result->fetchRow()) {
+                                       error_log("group found:  " . $row['share_with']);
                                        $usersInGroup = \OC_Group::usersInGroup($row['share_with']);
                                        $shares = array_merge($shares, $usersInGroup);
                                }