From 12b30cd70876584a5969336c6cc8f94b023f92eb Mon Sep 17 00:00:00 2001 From: Bjoern Schiessle Date: Wed, 25 Sep 2013 17:44:05 +0200 Subject: [PATCH] check if key exists before reading it --- apps/files_encryption/lib/keymanager.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/apps/files_encryption/lib/keymanager.php b/apps/files_encryption/lib/keymanager.php index 0304d1134c4..7143fcff0f6 100755 --- a/apps/files_encryption/lib/keymanager.php +++ b/apps/files_encryption/lib/keymanager.php @@ -40,11 +40,14 @@ class Keymanager { public static function getPrivateKey(\OC_FilesystemView $view, $user) { $path = '/' . $user . '/' . 'files_encryption' . '/' . $user . '.private.key'; + $key = false; $proxyStatus = \OC_FileProxy::$enabled; \OC_FileProxy::$enabled = false; - $key = $view->file_get_contents($path); + if ($view->file_exists($path)) { + $key = $view->file_get_contents($path); + } \OC_FileProxy::$enabled = $proxyStatus; @@ -569,4 +572,4 @@ class Keymanager { return $targetPath; } -} \ No newline at end of file +} -- 2.39.5