Browse Source
Merge pull request #23696 from nextcloud/fix/noid/fix-share-download-error-message
Return correct error message on share download without read permission
pull/23701/head
Roeland Jago Douma
5 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with
2 additions and
2 deletions
-
apps/files_sharing/lib/Controller/ShareController.php
-
apps/files_sharing/tests/Controller/ShareControllerTest.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; |
|
|
|
|
|
|
|
@ -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); |
|
|
|
} |
|
|
|
|
|
|
|
|