summaryrefslogtreecommitdiffstats
path: root/apps/files_encryption
diff options
context:
space:
mode:
authorBjörn Schießle <schiessle@owncloud.com>2013-06-25 14:42:49 +0200
committerBjörn Schießle <schiessle@owncloud.com>2013-07-05 15:59:38 +0200
commitabc2ee2e07e1e4f73e6e50aa3855d15ca92f6468 (patch)
tree08da6adb3257f5ca43e55cb5278584b40908fc8c /apps/files_encryption
parenteb2587a08ffc53efe284a06832f0a946d17aebf1 (diff)
downloadnextcloud-server-abc2ee2e07e1e4f73e6e50aa3855d15ca92f6468.tar.gz
nextcloud-server-abc2ee2e07e1e4f73e6e50aa3855d15ca92f6468.zip
handle rename correctly for system wide mounts
Diffstat (limited to 'apps/files_encryption')
-rw-r--r--apps/files_encryption/hooks/hooks.php25
1 files changed, 16 insertions, 9 deletions
diff --git a/apps/files_encryption/hooks/hooks.php b/apps/files_encryption/hooks/hooks.php
index 197982010f9..96f06b154f8 100644
--- a/apps/files_encryption/hooks/hooks.php
+++ b/apps/files_encryption/hooks/hooks.php
@@ -476,10 +476,19 @@ class Hooks {
$util = new Util($view, $userId);
// Format paths to be relative to user files dir
- $oldKeyfilePath = \OC\Files\Filesystem::normalizePath(
- $userId . '/' . 'files_encryption' . '/' . 'keyfiles' . '/' . $params['oldpath']);
- $newKeyfilePath = \OC\Files\Filesystem::normalizePath(
- $userId . '/' . 'files_encryption' . '/' . 'keyfiles' . '/' . $params['newpath']);
+ if ($util->isSystemWideMountPoint($params['oldpath'])) {
+ $baseDir = 'files_encryption/';
+ $oldKeyfilePath = $baseDir . 'keyfiles/' . $params['oldpath'];
+ } else {
+ $baseDir = $userId . '/' . 'files_encryption/';
+ $oldKeyfilePath = $baseDir . 'keyfiles/' . $params['oldpath'];
+ }
+
+ if ($util->isSystemWideMountPoint($params['newpath'])) {
+ $newKeyfilePath = $baseDir . 'keyfiles/' . $params['newpath'];
+ } else {
+ $newKeyfilePath = $baseDir . 'keyfiles/' . $params['newpath'];
+ }
// add key ext if this is not an folder
if (!$view->is_dir($oldKeyfilePath)) {
@@ -487,7 +496,7 @@ class Hooks {
$newKeyfilePath .= '.key';
// handle share-keys
- $localKeyPath = $view->getLocalFile($userId . '/files_encryption/share-keys/' . $params['oldpath']);
+ $localKeyPath = $view->getLocalFile($baseDir . 'share-keys/' . $params['oldpath']);
$matches = glob(preg_quote($localKeyPath) . '*.shareKey');
foreach ($matches as $src) {
$dst = \OC\Files\Filesystem::normalizePath(str_replace($params['oldpath'], $params['newpath'], $src));
@@ -502,10 +511,8 @@ class Hooks {
} else {
// handle share-keys folders
- $oldShareKeyfilePath = \OC\Files\Filesystem::normalizePath(
- $userId . '/' . 'files_encryption' . '/' . 'share-keys' . '/' . $params['oldpath']);
- $newShareKeyfilePath = \OC\Files\Filesystem::normalizePath(
- $userId . '/' . 'files_encryption' . '/' . 'share-keys' . '/' . $params['newpath']);
+ $oldShareKeyfilePath = $baseDir . 'share-keys/' . $params['oldpath'];
+ $newShareKeyfilePath = $baseDir . 'share-keys/' . $params['newpath'];
// create destination folder if not exists
if (!$view->file_exists(dirname($newShareKeyfilePath))) {