summaryrefslogtreecommitdiffstats
path: root/apps/files_encryption
diff options
context:
space:
mode:
authorBjörn Schießle <schiessle@owncloud.com>2014-07-29 16:29:28 +0200
committerBjörn Schießle <schiessle@owncloud.com>2014-07-29 16:29:28 +0200
commit2946a63f6bbcf298a30bb89ed72dbb650bc39def (patch)
treef7c3a70b803c4688f3930c793898af66a1d95e56 /apps/files_encryption
parentf7d60f1190e5842892bc0b65bdb8f5f41ba04750 (diff)
parentb5cb1cfe4e013d71686bed7b5db22fd4dbbdf7de (diff)
downloadnextcloud-server-2946a63f6bbcf298a30bb89ed72dbb650bc39def.tar.gz
nextcloud-server-2946a63f6bbcf298a30bb89ed72dbb650bc39def.zip
Merge pull request #9721 from owncloud/enc_define_type_in_pre_hook
[encryption] define type in pre hook
Diffstat (limited to 'apps/files_encryption')
-rw-r--r--apps/files_encryption/hooks/hooks.php11
1 files changed, 7 insertions, 4 deletions
diff --git a/apps/files_encryption/hooks/hooks.php b/apps/files_encryption/hooks/hooks.php
index 943e7dfcf50..2cde8144757 100644
--- a/apps/files_encryption/hooks/hooks.php
+++ b/apps/files_encryption/hooks/hooks.php
@@ -405,10 +405,14 @@ class Hooks {
$mp1 = $view->getMountPoint('/' . $user . '/files/' . $params['oldpath']);
$mp2 = $view->getMountPoint('/' . $user . '/files/' . $params['newpath']);
+ $type = $view->is_dir('/' . $user . '/files/' . $params['oldpath']) ? 'folder' : 'file';
+
if ($mp1 === $mp2) {
self::$renamedFiles[$params['oldpath']] = array(
'uid' => $ownerOld,
- 'path' => $pathOld);
+ 'path' => $pathOld,
+ 'type' => $type,
+ );
}
}
@@ -437,6 +441,7 @@ class Hooks {
isset(self::$renamedFiles[$params['oldpath']]['path'])) {
$ownerOld = self::$renamedFiles[$params['oldpath']]['uid'];
$pathOld = self::$renamedFiles[$params['oldpath']]['path'];
+ $type = self::$renamedFiles[$params['oldpath']]['type'];
unset(self::$renamedFiles[$params['oldpath']]);
} else {
\OCP\Util::writeLog('Encryption library', "can't get path and owner from the file before it was renamed", \OCP\Util::DEBUG);
@@ -471,8 +476,7 @@ class Hooks {
}
// handle share keys
- if (!$view->is_dir($oldKeyfilePath)) {
- $type = 'file';
+ if ($type === 'file') {
$oldKeyfilePath .= '.key';
$newKeyfilePath .= '.key';
@@ -484,7 +488,6 @@ class Hooks {
}
} else {
- $type = "folder";
// handle share-keys folders
$view->rename($oldShareKeyPath, $newShareKeyPath);
}