]> source.dussan.org Git - nextcloud-server.git/commitdiff
fixed re-share problems
authorFlorin Peter <github@florin-peter.de>
Wed, 1 May 2013 09:04:40 +0000 (11:04 +0200)
committerFlorin Peter <github@florin-peter.de>
Wed, 1 May 2013 09:04:40 +0000 (11:04 +0200)
apps/files_encryption/hooks/hooks.php
apps/files_encryption/lib/util.php

index 67d289ad68ac69009a22770713f58c899b1a2a60..c0e493752a0d72bb9961efc5707a71046c1d1315 100644 (file)
@@ -200,13 +200,13 @@ class Hooks {
                        $util = new Util($view, $userId);\r
                        $path = $util->fileIdToPath($params['itemSource']);\r
 \r
-                       //check if this is a reshare action, that's true if the item source is already shared with me\r
-                       $sharedItem = \OCP\Share::getItemSharedWithBySource($params['itemType'], $params['itemSource']);\r
+            //check if this is a reshare action, that's true if the item source is already shared with me\r
+                       $sharedItem = \OCP\Share::getItemSharedWithBySource($params['itemType'], $params['fileSource']);\r
                        if ($sharedItem) {\r
                                // if it is a re-share than the file is located in my Shared folder\r
                                $path = '/Shared'.$sharedItem['file_target'];\r
                        } else {\r
-                               $path = $util->fileIdToPath($params['itemSource']);\r
+                               $path = $util->fileIdToPath($params['fileSource']);\r
                        }\r
 \r
                        $sharingEnabled = \OCP\Share::isEnabled();\r
@@ -224,7 +224,7 @@ class Hooks {
                                $failed = array();\r
 \r
                                // Attempt to set shareKey\r
-                               if (!$util->setSharedFileKeyfiles($session, $usersSharing, $path)) {\r
+                               if (!$util->setSharedFileKeyfiles($session, $usersSharing, $path)) {\r
 \r
                                        $failed[] = $path;\r
                                }\r
index 4097250b252c18a4d92a71dd7650a160f012467b..eabb34f7ab0f415a16ec6b60312498836fa7d1e4 100644 (file)
@@ -983,14 +983,21 @@ class Util {
         */
        public function getAllFiles($dir) {
                $result = array();
-               
-               $content = $this->view->getDirectoryContent($this->userFilesDir.$dir);
+
+        $content = $this->view->getDirectoryContent($this->userFilesDir.$dir);
+
+        // handling for re shared folders
+        $path_split = explode( '/', $dir );
+        $shared = '';
+        if($path_split[1] === 'Shared') {
+            $shared = '/Shared';
+        }
 
                foreach ($content as $c) {
                        if ($c['type'] === "dir" ) {
-                               $result = array_merge($result, $this->getAllFiles(substr($c['path'],5)));
+                $result = array_merge($result, $this->getAllFiles($shared.substr($c['path'],5)));
                        } else {
-                               $result[] = substr($c['path'], 5);
+                $result[] = $shared.substr($c['path'], 5);
                        }
                }
                return $result;