]> source.dussan.org Git - nextcloud-server.git/commitdiff
del share keys from correct location
authorBjörn Schießle <schiessle@owncloud.com>
Tue, 25 Jun 2013 14:41:51 +0000 (16:41 +0200)
committerBjörn Schießle <schiessle@owncloud.com>
Fri, 5 Jul 2013 14:00:08 +0000 (16:00 +0200)
apps/files_encryption/lib/keymanager.php

index 0f608843740578fa7f30608e172dc648874e29bc..8de1d413642578abcd8cf98c226059850d992b42 100755 (executable)
@@ -475,10 +475,19 @@ class Keymanager {
         */
        public static function delAllShareKeys(\OC_FilesystemView $view, $userId, $filePath) {
 
+               $util = new util($view, $userId);
+
+               if ($util->isSystemWideMountPoint($filePath)) {
+                       $baseDir = '/files_encryption/share-keys/';
+               } else {
+                       $baseDir = $userId . '/files_encryption/share-keys/';
+               }
+
+
                if ($view->is_dir($userId . '/files/' . $filePath)) {
-                       $view->unlink($userId . '/files_encryption/share-keys/' . $filePath);
+                       $view->unlink($baseDir . $filePath);
                } else {
-                       $localKeyPath = $view->getLocalFile($userId . '/files_encryption/share-keys/' . $filePath);
+                       $localKeyPath = $view->getLocalFile($baseDir . $filePath);
                        $matches = glob(preg_quote($localKeyPath) . '*.shareKey');
                        foreach ($matches as $ma) {
                                $result = unlink($ma);
@@ -503,7 +512,11 @@ class Keymanager {
 
                list($owner, $filename) = $util->getUidAndFilename($filePath);
 
-               $shareKeyPath = \OC\Files\Filesystem::normalizePath('/' . $owner . '/files_encryption/share-keys/' . $filename);
+               if ($util->isSystemWideMountPoint($filename)) {
+                       $shareKeyPath = \OC\Files\Filesystem::normalizePath('/files_encryption/share-keys/' . $filename);
+               } else {
+                       $shareKeyPath = \OC\Files\Filesystem::normalizePath('/' . $owner . '/files_encryption/share-keys/' . $filename);
+               }
 
                if ($view->is_dir($shareKeyPath)) {