summaryrefslogtreecommitdiffstats
path: root/apps/files_encryption
diff options
context:
space:
mode:
authorBjoern Schiessle <schiessle@owncloud.com>2014-06-30 16:28:40 +0200
committerBjoern Schiessle <schiessle@owncloud.com>2014-06-30 16:28:40 +0200
commit618c9fd033231fe113c4e89607b4f0f213e81d81 (patch)
treeb614026d9af7ff8cb5f639e71abe70710637af29 /apps/files_encryption
parent1004836fd309f368dd1d7b6b5260f50f1b3de492 (diff)
downloadnextcloud-server-618c9fd033231fe113c4e89607b4f0f213e81d81.tar.gz
nextcloud-server-618c9fd033231fe113c4e89607b4f0f213e81d81.zip
improved error message
Diffstat (limited to 'apps/files_encryption')
-rwxr-xr-xapps/files_encryption/lib/keymanager.php15
1 files changed, 8 insertions, 7 deletions
diff --git a/apps/files_encryption/lib/keymanager.php b/apps/files_encryption/lib/keymanager.php
index d8e4697aaf1..70820a6f940 100755
--- a/apps/files_encryption/lib/keymanager.php
+++ b/apps/files_encryption/lib/keymanager.php
@@ -228,21 +228,23 @@ class Keymanager {
}
$result = false;
+ $fileExists = $view->file_exists('/' . $userId . '/files/' . $trimmed);
- if ($view->is_dir($keyPath) && !$view->file_exists('/' . $userId . '/files/' . $trimmed)) {
+ if ($view->is_dir($keyPath) && !$fileExists) {
\OCP\Util::writeLog('files_encryption', 'deleteFileKey: delete file key: ' . $keyPath, \OCP\Util::DEBUG);
$result = $view->unlink($keyPath);
- } elseif ($view->file_exists($keyPath . '.key') && !$view->file_exists('/' . $userId . '/files/' . $trimmed)) {
+ } elseif ($view->file_exists($keyPath . '.key') && !$fileExists) {
\OCP\Util::writeLog('files_encryption', 'deleteFileKey: delete file key: ' . $keyPath, \OCP\Util::DEBUG);
$result = $view->unlink($keyPath . '.key');
}
- if (!$result) {
-
+ if ($fileExists) {
\OCP\Util::writeLog('Encryption library',
- 'Could not delete keyfile; does not exist: "' . $keyPath, \OCP\Util::ERROR);
-
+ 'Did not delete the file key, file still exists: ' . '/' . $userId . '/files/' . $trimmed, \OCP\Util::ERROR);
+ } elseif (!$result) {
+ \OCP\Util::writeLog('Encryption library',
+ 'Could not delete keyfile; does not exist: "' . $keyPath, \OCP\Util::ERROR);
}
return $result;
@@ -508,7 +510,6 @@ class Keymanager {
$realFile = $realFileDir . self::getFilenameFromShareKey($file);
foreach ($userIds as $userId) {
if (preg_match("/(.*)." . $userId . ".shareKey/", $file)) {
- //TODO from $dir I need to strip /user/files_encryption/share-keys
if ($userId === $owner &&
$view->file_exists($realFile)) {
\OCP\Util::writeLog('files_encryption', 'original file still exists, keep owners share key!', \OCP\Util::ERROR);