Merge pull request #4991 from owncloud/enc_fix_warning
check if key exists before reading it
This commit is contained in:
commit
2334f96906
|
@ -40,11 +40,14 @@ class Keymanager {
|
||||||
public static function getPrivateKey(\OC_FilesystemView $view, $user) {
|
public static function getPrivateKey(\OC_FilesystemView $view, $user) {
|
||||||
|
|
||||||
$path = '/' . $user . '/' . 'files_encryption' . '/' . $user . '.private.key';
|
$path = '/' . $user . '/' . 'files_encryption' . '/' . $user . '.private.key';
|
||||||
|
$key = false;
|
||||||
|
|
||||||
$proxyStatus = \OC_FileProxy::$enabled;
|
$proxyStatus = \OC_FileProxy::$enabled;
|
||||||
\OC_FileProxy::$enabled = false;
|
\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;
|
\OC_FileProxy::$enabled = $proxyStatus;
|
||||||
|
|
||||||
|
|
|
@ -50,9 +50,8 @@ class Proxy extends \OC_FileProxy {
|
||||||
private static function shouldEncrypt($path) {
|
private static function shouldEncrypt($path) {
|
||||||
|
|
||||||
if (is_null(self::$enableEncryption)) {
|
if (is_null(self::$enableEncryption)) {
|
||||||
|
|
||||||
if (
|
if (
|
||||||
\OCP\Config::getAppValue('files_encryption', 'enable_encryption', 'true') === 'true'
|
\OCP\App::isEnabled('files_encryption') === true
|
||||||
&& Crypt::mode() === 'server'
|
&& Crypt::mode() === 'server'
|
||||||
) {
|
) {
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue