]> source.dussan.org Git - nextcloud-server.git/commitdiff
handle rename correctly for system wide mounts
authorBjörn Schießle <schiessle@owncloud.com>
Tue, 25 Jun 2013 12:42:49 +0000 (14:42 +0200)
committerBjörn Schießle <schiessle@owncloud.com>
Fri, 5 Jul 2013 13:59:38 +0000 (15:59 +0200)
apps/files_encryption/hooks/hooks.php

index 197982010f94e2517b757b5554d6116c9af36f22..96f06b154f82f98bb94e129b65afc5b2ab6150a9 100644 (file)
@@ -476,10 +476,19 @@ class Hooks {
                $util = new Util($view, $userId);\r
 \r
                // Format paths to be relative to user files dir\r
-               $oldKeyfilePath = \OC\Files\Filesystem::normalizePath(\r
-                       $userId . '/' . 'files_encryption' . '/' . 'keyfiles' . '/' . $params['oldpath']);\r
-               $newKeyfilePath = \OC\Files\Filesystem::normalizePath(\r
-                       $userId . '/' . 'files_encryption' . '/' . 'keyfiles' . '/' . $params['newpath']);\r
+               if ($util->isSystemWideMountPoint($params['oldpath'])) {\r
+                       $baseDir = 'files_encryption/';\r
+                       $oldKeyfilePath = $baseDir . 'keyfiles/' . $params['oldpath'];\r
+               } else {\r
+                       $baseDir = $userId . '/' . 'files_encryption/';\r
+                       $oldKeyfilePath = $baseDir . 'keyfiles/' . $params['oldpath'];\r
+               }\r
+\r
+               if ($util->isSystemWideMountPoint($params['newpath'])) {\r
+                       $newKeyfilePath =  $baseDir . 'keyfiles/' . $params['newpath'];\r
+               } else {\r
+                       $newKeyfilePath = $baseDir . 'keyfiles/' . $params['newpath'];\r
+               }\r
 \r
                // add key ext if this is not an folder\r
                if (!$view->is_dir($oldKeyfilePath)) {\r
@@ -487,7 +496,7 @@ class Hooks {
                        $newKeyfilePath .= '.key';\r
 \r
                        // handle share-keys\r
-                       $localKeyPath = $view->getLocalFile($userId . '/files_encryption/share-keys/' . $params['oldpath']);\r
+                       $localKeyPath = $view->getLocalFile($baseDir . 'share-keys/' . $params['oldpath']);\r
                        $matches = glob(preg_quote($localKeyPath) . '*.shareKey');\r
                        foreach ($matches as $src) {\r
                                $dst = \OC\Files\Filesystem::normalizePath(str_replace($params['oldpath'], $params['newpath'], $src));\r
@@ -502,10 +511,8 @@ class Hooks {
 \r
                } else {\r
                        // handle share-keys folders\r
-                       $oldShareKeyfilePath = \OC\Files\Filesystem::normalizePath(\r
-                               $userId . '/' . 'files_encryption' . '/' . 'share-keys' . '/' . $params['oldpath']);\r
-                       $newShareKeyfilePath = \OC\Files\Filesystem::normalizePath(\r
-                               $userId . '/' . 'files_encryption' . '/' . 'share-keys' . '/' . $params['newpath']);\r
+                       $oldShareKeyfilePath = $baseDir . 'share-keys/' . $params['oldpath'];\r
+                       $newShareKeyfilePath = $baseDir . 'share-keys/' . $params['newpath'];\r
 \r
                        // create destination folder if not exists\r
                        if (!$view->file_exists(dirname($newShareKeyfilePath))) {\r