From 5080080a3677fe0e67995634bda46de73b502713 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Tue, 10 Oct 2017 12:54:35 +0200 Subject: [PATCH 1/4] Anything but true means it failed Signed-off-by: Joas Schilling --- core/Command/Encryption/ChangeKeyStorageRoot.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/Command/Encryption/ChangeKeyStorageRoot.php b/core/Command/Encryption/ChangeKeyStorageRoot.php index 7c6ad5d612665..5fbef6a0c9125 100644 --- a/core/Command/Encryption/ChangeKeyStorageRoot.php +++ b/core/Command/Encryption/ChangeKeyStorageRoot.php @@ -146,7 +146,7 @@ protected function prepareNewRoot($newRoot) { 'ownCloud will detect this folder as key storage root only if this file exists' ); - if ($result === false) { + if ($result !== true) { throw new \Exception("Can't write to new root folder. Please check the permissions and try again"); } From 31397debaf97b3b1688b922c81f2f39fff10295d Mon Sep 17 00:00:00 2001 From: Bjoern Schiessle Date: Thu, 1 Mar 2018 17:49:20 +0100 Subject: [PATCH 2/4] fix check and improve error message Signed-off-by: Bjoern Schiessle --- core/Command/Encryption/ChangeKeyStorageRoot.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/Command/Encryption/ChangeKeyStorageRoot.php b/core/Command/Encryption/ChangeKeyStorageRoot.php index 5fbef6a0c9125..e2f01e1cb3c51 100644 --- a/core/Command/Encryption/ChangeKeyStorageRoot.php +++ b/core/Command/Encryption/ChangeKeyStorageRoot.php @@ -146,8 +146,8 @@ protected function prepareNewRoot($newRoot) { 'ownCloud will detect this folder as key storage root only if this file exists' ); - if ($result !== true) { - throw new \Exception("Can't write to new root folder. Please check the permissions and try again"); + if (!$result) { + throw new \Exception("Can't access the new root folder. Please check the permissions and make sure that the folder is in your data folder"); } } From 9259b8a90ee66705f2d4c00893dede9f693ec592 Mon Sep 17 00:00:00 2001 From: Bjoern Schiessle Date: Thu, 1 Mar 2018 17:49:53 +0100 Subject: [PATCH 3/4] s/ownCloud/Nextcloud Signed-off-by: Bjoern Schiessle --- core/Command/Encryption/ChangeKeyStorageRoot.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/Command/Encryption/ChangeKeyStorageRoot.php b/core/Command/Encryption/ChangeKeyStorageRoot.php index e2f01e1cb3c51..15e8832697362 100644 --- a/core/Command/Encryption/ChangeKeyStorageRoot.php +++ b/core/Command/Encryption/ChangeKeyStorageRoot.php @@ -143,7 +143,7 @@ protected function prepareNewRoot($newRoot) { $result = $this->rootView->file_put_contents( $newRoot . '/' . Storage::KEY_STORAGE_MARKER, - 'ownCloud will detect this folder as key storage root only if this file exists' + 'Nextcloud will detect this folder as key storage root only if this file exists' ); if (!$result) { From 3a3368336440dc0cecf82b48b96879ebdeb6bb75 Mon Sep 17 00:00:00 2001 From: Bjoern Schiessle Date: Fri, 2 Mar 2018 15:20:07 +0100 Subject: [PATCH 4/4] update unit tests Signed-off-by: Bjoern Schiessle --- tests/Core/Command/Encryption/ChangeKeyStorageRootTest.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/Core/Command/Encryption/ChangeKeyStorageRootTest.php b/tests/Core/Command/Encryption/ChangeKeyStorageRootTest.php index 57eb2137ac198..4ecea745cfaeb 100644 --- a/tests/Core/Command/Encryption/ChangeKeyStorageRootTest.php +++ b/tests/Core/Command/Encryption/ChangeKeyStorageRootTest.php @@ -175,7 +175,7 @@ public function testPrepareNewRoot() { $this->view->expects($this->once())->method('file_put_contents') ->with('newRoot/' . \OC\Encryption\Keys\Storage::KEY_STORAGE_MARKER, - 'ownCloud will detect this folder as key storage root only if this file exists'); + 'Nextcloud will detect this folder as key storage root only if this file exists')->willReturn(true); $this->invokePrivate($this->changeKeyStorageRoot, 'prepareNewRoot', ['newRoot']); } @@ -198,6 +198,7 @@ public function testPrepareNewRootException($dirExists, $couldCreateFile) { public function dataTestPrepareNewRootException() { return [ [true, false], + [true, null], [false, true] ]; }