]> source.dussan.org Git - nextcloud-server.git/commitdiff
Unsharing a single file now works
authorSam Tuke <samtuke@owncloud.com>
Wed, 27 Feb 2013 15:31:23 +0000 (15:31 +0000)
committerSam Tuke <samtuke@owncloud.com>
Wed, 27 Feb 2013 15:31:23 +0000 (15:31 +0000)
apps/files_encryption/hooks/hooks.php
apps/files_encryption/lib/keymanager.php

index bf16a492e3318a3e96d26c7678da9218d2c1b148..fb3545208d21078e511eb9e2b71159ab45e3772e 100644 (file)
@@ -245,11 +245,13 @@ class Hooks {
                        $util = new Util( $view, $userId );\r
                        $path = $util->fileIdToPath( $params['itemSource'] );\r
                \r
+                       // If path is a folder, get all children\r
                        $allPaths = $util->getPaths( $path );\r
                        \r
                        foreach ( $allPaths as $path ) {\r
                        \r
-                               if ( ! Keymanager::delShareKey( $view, $userId, $path ) ) {\r
+                               // Unshare each child path\r
+                               if ( ! Keymanager::delShareKey( $view, $params['shareWith'], $path ) ) {\r
                                \r
                                        $failed[] = $path;\r
                                        \r
index 22e2ffa500e055ea9affc8745952ce03c246dc82..62bb12bf90da75003c50bfe06068b30a573b399b 100755 (executable)
@@ -355,6 +355,8 @@ class Keymanager {
         */\r
        public static function delShareKey( \OC_FilesystemView $view, $userId, $filePath ) {\r
                \r
+               \OC_FileProxy::$enabled = false;\r
+               \r
                $trimmed = ltrim( $filePath, '/' );\r
                $shareKeyPath =  '/' . $userId . '/files_encryption/share-keys/' . $trimmed . '.shareKey';\r
                \r
@@ -362,16 +364,22 @@ class Keymanager {
                // true), so we perform our own test\r
                if ( $view->file_exists( $shareKeyPath ) ) {\r
                \r
-                       return $view->unlink( $shareKeyPath );\r
+                       $result = $view->unlink( $shareKeyPath );\r
                        \r
                } else {\r
                        \r
+                       trigger_error("Could not delete shareKey; does not exist: $shareKeyPath");\r
+                       \r
                        \OC_Log::write( 'Encryption library', 'Could not delete shareKey; does not exist: "' . $shareKeyPath, \OC_Log::ERROR );\r
                        \r
-                       return false;\r
+                       $result = false;\r
                        \r
                }\r
                \r
+               \OC_FileProxy::$enabled = false;\r
+               \r
+               return $result;\r
+               \r
        }\r
        \r
        /**\r