diff options
author | Bjoern Schiessle <schiessle@owncloud.com> | 2014-06-30 18:28:40 +0400 |
---|---|---|
committer | Bjoern Schiessle <schiessle@owncloud.com> | 2014-06-30 18:32:20 +0400 |
commit | 46ade71b5a472369e98c2631aa774879298b6072 (patch) | |
tree | 91dfe98c28d01c5df22fe29db436a1269d543b56 /apps/files_encryption | |
parent | 22cef86b91b35cce67d3bb35fa4248bdc6669f7c (diff) |
improved error message
Diffstat (limited to 'apps/files_encryption')
-rwxr-xr-x | apps/files_encryption/lib/keymanager.php | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/apps/files_encryption/lib/keymanager.php b/apps/files_encryption/lib/keymanager.php index 9f706aefc77..b4197a2067b 100755 --- a/apps/files_encryption/lib/keymanager.php +++ b/apps/files_encryption/lib/keymanager.php @@ -241,21 +241,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; @@ -521,7 +523,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); |