diff options
author | Bjoern Schiessle <schiessle@owncloud.com> | 2014-02-24 13:56:53 +0100 |
---|---|---|
committer | Bjoern Schiessle <schiessle@owncloud.com> | 2014-02-24 17:24:43 +0100 |
commit | ebd73aee8ff96f7252fab65ab4dc7230d2eb551c (patch) | |
tree | 089029cee5115dea63c3282e1aac1832b91289a2 /apps/files_encryption/hooks | |
parent | 11ca01403408413cbbe48c8d78c41802998868b7 (diff) | |
download | nextcloud-server-ebd73aee8ff96f7252fab65ab4dc7230d2eb551c.tar.gz nextcloud-server-ebd73aee8ff96f7252fab65ab4dc7230d2eb551c.zip |
don't overwrite keys if rename was done by a stream copy
Diffstat (limited to 'apps/files_encryption/hooks')
-rw-r--r-- | apps/files_encryption/hooks/hooks.php | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/apps/files_encryption/hooks/hooks.php b/apps/files_encryption/hooks/hooks.php index 3af43f10264..0b6c5adf3fb 100644 --- a/apps/files_encryption/hooks/hooks.php +++ b/apps/files_encryption/hooks/hooks.php @@ -501,11 +501,20 @@ class Hooks { * @param array $params with the old path and the new path
*/
public static function preRename($params) {
- $util = new Util(new \OC_FilesystemView('/'), \OCP\User::getUser());
+ $user = \OCP\User::getUser();
+ $view = new \OC_FilesystemView('/');
+ $util = new Util($view, $user);
list($ownerOld, $pathOld) = $util->getUidAndFilename($params['oldpath']);
- self::$renamedFiles[$params['oldpath']] = array(
- 'uid' => $ownerOld,
- 'path' => $pathOld);
+
+ // we only need to rename the keys if the rename happens on the same mountpoint
+ // otherwise we perform a stream copy, so we get a new set of keys
+ $mp1 = $view->getMountPoint('/' . $user . '/files/' . $params['oldpath']);
+ $mp2 = $view->getMountPoint('/' . $user . '/files/' . $params['newpath']);
+ if ($mp1 === $mp2) {
+ self::$renamedFiles[$params['oldpath']] = array(
+ 'uid' => $ownerOld,
+ 'path' => $pathOld);
+ }
}
/**
|