]> source.dussan.org Git - nextcloud-server.git/commitdiff
fix share and un-share for single file
authorFlorin Peter <github@florin-peter.de>
Wed, 29 May 2013 23:38:11 +0000 (01:38 +0200)
committerFlorin Peter <github@florin-peter.de>
Fri, 31 May 2013 10:28:29 +0000 (12:28 +0200)
apps/files_encryption/hooks/hooks.php

index 9893cecc94e32924ecca6db1a2d3363b1a5365ba..eb9a2600d70d1aaaf9849dd87e65fce545e01950 100644 (file)
@@ -327,15 +327,14 @@ class Hooks {
 \r
                        $sharingEnabled = \OCP\Share::isEnabled();\r
 \r
+                       // get the path including mount point only if not a shared folder\r
+                       if(strncmp($path, '/Shared' , strlen('/Shared') !== 0)) {\r
+                               // get path including the the storage mount point\r
+                               $path = $util->getPathWithMountPoint($params['itemSource']);\r
+                       }\r
+\r
                        // if a folder was shared, get a list of all (sub-)folders\r
                        if ($params['itemType'] === 'folder') {\r
-\r
-                               // get the path including mount point only if not a shared folder\r
-                               if(strncmp($path, '/Shared' , strlen('/Shared') !== 0)) {\r
-                                       // get path including the the storage mount point\r
-                                       $path = $util->getPathWithMountPoint($params['itemSource']);\r
-                               }\r
-\r
                                $allFiles = $util->getAllFiles($path);\r
                        } else {\r
                                $allFiles = array($path);\r
@@ -383,17 +382,11 @@ class Hooks {
 \r
                                // rebuild path\r
                                foreach ($targetPathSplit as $pathPart) {\r
-\r
                                        if ($pathPart !== $sharedPart) {\r
-\r
                                                $path = '/' . $pathPart . $path;\r
-\r
                                        } else {\r
-\r
                                                break;\r
-\r
                                        }\r
-\r
                                }\r
 \r
                                // prefix path with Shared\r
@@ -411,19 +404,16 @@ class Hooks {
                                }\r
                        }\r
 \r
-                       // if we unshare a folder we need a list of all (sub-)files\r
-                       if ( $params['itemType'] === 'folder' ) {\r
-\r
-                               // get the path including mount point only if not a shared folder\r
-                               if(strncmp($path, '/Shared' , strlen('/Shared') !== 0)) {\r
-                                       // get path including the the storage mount point\r
-                                       $path = $util->getPathWithMountPoint($params['itemSource']);\r
-                               }\r
+                       // get the path including mount point only if not a shared folder\r
+                       if(strncmp($path, '/Shared' , strlen('/Shared') !== 0)) {\r
+                               // get path including the the storage mount point\r
+                               $path = $util->getPathWithMountPoint($params['itemSource']);\r
+                       }\r
 \r
+                       // if we unshare a folder we need a list of all (sub-)files\r
+                       if ($params['itemType'] === 'folder') {\r
                                $allFiles = $util->getAllFiles( $path );\r
-                               \r
                        } else {\r
-\r
                                $allFiles = array($path);\r
                        }\r
 \r