summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFlorin Peter <github@florin-peter.de>2013-05-29 12:23:33 +0200
committerFlorin Peter <github@florin-peter.de>2013-05-29 12:23:33 +0200
commitefd629462e4a497c15804f55a5dfc231ee5be4bb (patch)
tree64dac02585992351b462d117bab95459b4a1a422
parentc398fc59ad870751cee73a2fbef8bc75233a7515 (diff)
downloadnextcloud-server-efd629462e4a497c15804f55a5dfc231ee5be4bb.tar.gz
nextcloud-server-efd629462e4a497c15804f55a5dfc231ee5be4bb.zip
changes after review
-rw-r--r--apps/files_encryption/lib/util.php6
1 files changed, 5 insertions, 1 deletions
diff --git a/apps/files_encryption/lib/util.php b/apps/files_encryption/lib/util.php
index 16a5e8d7653..0d663549bf6 100644
--- a/apps/files_encryption/lib/util.php
+++ b/apps/files_encryption/lib/util.php
@@ -1422,6 +1422,7 @@ class Util {
} else {
$session = new \OCA\Encryption\Session(new \OC_FilesystemView('/'));
$sharingEnabled = \OCP\Share::isEnabled();
+ // remove '.key' extension from path e.g. 'file.txt.key' to 'file.txt'
$file = substr($filePath, 0, -4);
$usersSharing = $this->getSharingUsersArray($sharingEnabled, $file);
$this->setSharedFileKeyfiles($session, $usersSharing, $file);
@@ -1440,6 +1441,7 @@ class Util {
if ($item['type'] === 'dir') {
$this->removeRecoveryKeys($filePath . '/');
} else {
+ // remove '.key' extension from path e.g. 'file.txt.key' to 'file.txt'
$file = substr($filePath, 0, -4);
$this->view->unlink($this->shareKeysPath . '/' . $file . '.' . $this->recoveryKeyId . '.shareKey');
}
@@ -1502,10 +1504,12 @@ class Util {
private function recoverAllFiles($path, $privateKey) {
$dirContent = $this->view->getDirectoryContent($this->keyfilesPath . $path);
foreach ($dirContent as $item) {
- $filePath = substr($item['path'], 25);
+ // get relative path from files_encryption/keyfiles
+ $filePath = substr($item['path'], strlen('files_encryption/keyfiles'));
if ($item['type'] === 'dir') {
$this->recoverAllFiles($filePath . '/', $privateKey);
} else {
+ // remove '.key' extension from path e.g. 'file.txt.key' to 'file.txt'
$file = substr($filePath, 0, -4);
$this->recoverFile($file, $privateKey);
}