mirror of
https://we.phorge.it/source/phorge.git
synced 2025-01-11 07:11:04 +01:00
When an invalid "constraints" parameter is provided to a "*.search" method, raise a more tailored error
Summary: See <https://discourse.phabricator-community.org/t/constraints-parameter-type-handling-in-maniphest-search/2636>. (The caller provided `constraints={...}` via cURL, but you can't mix JSON and HTTP parameters like that.) Test Plan: Called `curl 'http://local.phacility.com/api/maniphest.search?api.token=...&constraints=X'` (with a valid API token), got a more sensible error. Reviewers: amckinley Reviewed By: amckinley Differential Revision: https://secure.phabricator.com/D20429
This commit is contained in:
parent
23b86bae6c
commit
382e2c32fc
1 changed files with 6 additions and 0 deletions
|
@ -1142,6 +1142,12 @@ abstract class PhabricatorApplicationSearchEngine extends Phobject {
|
|||
}
|
||||
|
||||
$constraints = $request->getValue('constraints', array());
|
||||
if (!is_array($constraints)) {
|
||||
throw new Exception(
|
||||
pht(
|
||||
'Parameter "constraints" must be a map of constraints, got "%s".',
|
||||
phutil_describe_type($constraints)));
|
||||
}
|
||||
|
||||
$fields = $this->getSearchFieldsForConduit();
|
||||
|
||||
|
|
Loading…
Reference in a new issue