From 0390a90d70104c2b3237feb05c3398f8ea1612c9 Mon Sep 17 00:00:00 2001 From: Morris Jobke Date: Mon, 26 Oct 2020 16:22:27 +0100 Subject: [PATCH] Return correct error message on share download without read permission Signed-off-by: Morris Jobke --- apps/files_sharing/lib/Controller/ShareController.php | 2 +- apps/files_sharing/tests/Controller/ShareControllerTest.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/files_sharing/lib/Controller/ShareController.php b/apps/files_sharing/lib/Controller/ShareController.php index fdf69abd9a..3e514b3a74 100644 --- a/apps/files_sharing/lib/Controller/ShareController.php +++ b/apps/files_sharing/lib/Controller/ShareController.php @@ -556,7 +556,7 @@ class ShareController extends AuthPublicShareController { $share = $this->shareManager->getShareByToken($token); if (!($share->getPermissions() & \OCP\Constants::PERMISSION_READ)) { - return new \OCP\AppFramework\Http\DataResponse('Share is read-only'); + return new \OCP\AppFramework\Http\DataResponse('Share has no read permission'); } $files_list = null; diff --git a/apps/files_sharing/tests/Controller/ShareControllerTest.php b/apps/files_sharing/tests/Controller/ShareControllerTest.php index 33dff13caf..270f38a114 100644 --- a/apps/files_sharing/tests/Controller/ShareControllerTest.php +++ b/apps/files_sharing/tests/Controller/ShareControllerTest.php @@ -840,7 +840,7 @@ class ShareControllerTest extends \Test\TestCase { // Test with a password protected share and no authentication $response = $this->shareController->downloadShare('validtoken'); - $expectedResponse = new DataResponse('Share is read-only'); + $expectedResponse = new DataResponse('Share has no read permission'); $this->assertEquals($expectedResponse, $response); }