]> source.dussan.org Git - nextcloud-server.git/commitdiff
check if key exists before reading it
authorBjoern Schiessle <schiessle@owncloud.com>
Wed, 25 Sep 2013 15:44:05 +0000 (17:44 +0200)
committerBjoern Schiessle <schiessle@owncloud.com>
Thu, 26 Sep 2013 09:06:58 +0000 (11:06 +0200)
apps/files_encryption/lib/keymanager.php

index 5386de486e190d93aa5671e577d53aa2ba651033..6863b0871c77fef2d741728cba5844614a47d0eb 100755 (executable)
@@ -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;