From 917f389747dc3b8b3d5b9ff326a2cee21579f58a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Thomas=20M=C3=BCller?= <thomas.mueller@tmit.eu>
Date: Wed, 4 Jun 2014 08:21:28 +0200
Subject: [PATCH] workaround to get the unit test going

---
 apps/files_encryption/hooks/hooks.php | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/apps/files_encryption/hooks/hooks.php b/apps/files_encryption/hooks/hooks.php
index 8fae901fe63..d1ee4a97d15 100644
--- a/apps/files_encryption/hooks/hooks.php
+++ b/apps/files_encryption/hooks/hooks.php
@@ -99,12 +99,14 @@ class Hooks {
 
 			// Set legacy encryption key if it exists, to support
 			// depreciated encryption system
-			$encLegacyKey = $userView->file_get_contents('encryption.key');
-			if ($encLegacyKey) {
+			if ($userView->file_exists('encryption.key')) {
+				$encLegacyKey = $userView->file_get_contents('encryption.key');
+				if ($encLegacyKey) {
 
-				$plainLegacyKey = Crypt::legacyDecrypt($encLegacyKey, $params['password']);
+					$plainLegacyKey = Crypt::legacyDecrypt($encLegacyKey, $params['password']);
 
-				$session->setLegacyKey($plainLegacyKey);
+					$session->setLegacyKey($plainLegacyKey);
+				}
 			}
 
 			// Encrypt existing user files
-- 
GitLab