summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorRoeland Jago Douma <rullzer@users.noreply.github.com>2020-01-06 08:06:27 +0100
committerGitHub <noreply@github.com>2020-01-06 08:06:27 +0100
commit03cdff0da48f7ba471f7fe70753c4abd568d7adc (patch)
tree9fcc0586aa214e75b283003a2b399af27b58260e /apps
parent32f79c9f0c3b9ca30b31577971b1dfd7c190a3fc (diff)
parent1672ff3bef9c44e5626c602e62090c18784a7b61 (diff)
downloadnextcloud-server-03cdff0da48f7ba471f7fe70753c4abd568d7adc.tar.gz
nextcloud-server-03cdff0da48f7ba471f7fe70753c4abd568d7adc.zip
Merge pull request #18674 from nextcloud/enh/no_global_GET
Do not use $_GET
Diffstat (limited to 'apps')
-rw-r--r--apps/files_sharing/lib/Controller/ShareesAPIController.php7
-rw-r--r--apps/files_sharing/tests/Controller/ShareesAPIControllerTest.php7
2 files changed, 8 insertions, 6 deletions
diff --git a/apps/files_sharing/lib/Controller/ShareesAPIController.php b/apps/files_sharing/lib/Controller/ShareesAPIController.php
index d556ab76f65..61678e67c17 100644
--- a/apps/files_sharing/lib/Controller/ShareesAPIController.php
+++ b/apps/files_sharing/lib/Controller/ShareesAPIController.php
@@ -198,13 +198,12 @@ class ShareesAPIController extends OCSController {
$shareTypes[] = Share::SHARE_TYPE_CIRCLE;
}
- if (isset($_GET['shareType']) && is_array($_GET['shareType'])) {
- $shareTypes = array_intersect($shareTypes, $_GET['shareType']);
- sort($shareTypes);
+ if ($shareType !== null && is_array($shareType)) {
+ $shareTypes = array_intersect($shareTypes, $shareType);
} else if (is_numeric($shareType)) {
$shareTypes = array_intersect($shareTypes, [(int) $shareType]);
- sort($shareTypes);
}
+ sort($shareTypes);
$this->shareWithGroupOnly = $this->config->getAppValue('core', 'shareapi_only_share_with_group_members', 'no') === 'yes';
$this->shareeEnumeration = $this->config->getAppValue('core', 'shareapi_allow_share_dialog_user_enumeration', 'yes') === 'yes';
diff --git a/apps/files_sharing/tests/Controller/ShareesAPIControllerTest.php b/apps/files_sharing/tests/Controller/ShareesAPIControllerTest.php
index 8c0c5b1e41c..1fb14ad9b8f 100644
--- a/apps/files_sharing/tests/Controller/ShareesAPIControllerTest.php
+++ b/apps/files_sharing/tests/Controller/ShareesAPIControllerTest.php
@@ -271,9 +271,12 @@ class ShareesAPIControllerTest extends TestCase {
->setMethods(['isRemoteSharingAllowed', 'shareProviderExists', 'isRemoteGroupSharingAllowed'])
->getMock();
+ $expectedShareTypes = $shareTypes;
+ sort($expectedShareTypes);
+
$this->collaboratorSearch->expects($this->once())
->method('search')
- ->with($search, $shareTypes, $this->anything(), $perPage, $perPage * ($page -1))
+ ->with($search, $expectedShareTypes, $this->anything(), $perPage, $perPage * ($page -1))
->willReturn([[], false]);
$sharees->expects($this->any())
@@ -398,7 +401,7 @@ class ShareesAPIControllerTest extends TestCase {
$this->assertSame($expected, $this->invokePrivate($this->sharees, 'isRemoteSharingAllowed', [$itemType]));
}
-
+
public function testSearchNoItemType() {
$this->expectException(\OCP\AppFramework\OCS\OCSBadRequestException::class);
$this->expectExceptionMessage('Missing itemType');