From: Bjoern Schiessle Date: Wed, 25 Sep 2013 15:44:05 +0000 (+0200) Subject: check if key exists before reading it X-Git-Tag: v5.0.13~33 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=12b30cd70876584a5969336c6cc8f94b023f92eb;p=nextcloud-server.git check if key exists before reading it --- 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 +}