mirror of
https://github.com/nextcloud/server.git
synced 2026-03-14 14:43:06 -04:00
Merge pull request #41486 from nextcloud/fix/41470/invalid_user_group
Fix invalid users/groups handling in advanced search
This commit is contained in:
commit
ae31d03217
3 changed files with 8 additions and 5 deletions
|
|
@ -28,6 +28,7 @@ declare(strict_types=1);
|
|||
*/
|
||||
namespace OC\Core\Controller;
|
||||
|
||||
use InvalidArgumentException;
|
||||
use OC\Search\SearchComposer;
|
||||
use OC\Search\SearchQuery;
|
||||
use OCA\Core\ResponseDefinitions;
|
||||
|
|
@ -111,7 +112,7 @@ class UnifiedSearchController extends OCSController {
|
|||
|
||||
try {
|
||||
$filters = $this->composer->buildFilterList($providerId, $this->request->getParams());
|
||||
} catch (UnsupportedFilter $e) {
|
||||
} catch (UnsupportedFilter|InvalidArgumentException $e) {
|
||||
return new DataResponse($e->getMessage(), Http::STATUS_BAD_REQUEST);
|
||||
}
|
||||
return new DataResponse(
|
||||
|
|
|
|||
|
|
@ -38,10 +38,11 @@ class GroupFilter implements IFilter {
|
|||
string $value,
|
||||
IGroupManager $groupManager,
|
||||
) {
|
||||
$this->group = $groupManager->get($value);
|
||||
if ($this->group === null) {
|
||||
$group = $groupManager->get($value);
|
||||
if ($group === null) {
|
||||
throw new InvalidArgumentException('Group '.$value.' not found');
|
||||
}
|
||||
$this->group = $group;
|
||||
}
|
||||
|
||||
public function get(): IGroup {
|
||||
|
|
|
|||
|
|
@ -38,10 +38,11 @@ class UserFilter implements IFilter {
|
|||
string $value,
|
||||
IUserManager $userManager,
|
||||
) {
|
||||
$this->user = $userManager->get($value);
|
||||
if ($this->user === null) {
|
||||
$user = $userManager->get($value);
|
||||
if ($user === null) {
|
||||
throw new InvalidArgumentException('User '.$value.' not found');
|
||||
}
|
||||
$this->user = $user;
|
||||
}
|
||||
|
||||
public function get(): IUser {
|
||||
|
|
|
|||
Loading…
Reference in a new issue