mirror of
https://github.com/nextcloud/server.git
synced 2026-02-03 20:41:22 -05:00
fix(dav): throw invalid argument when property type does not match
* Resolves https://github.com/nextcloud/server/issues/49972 Currently a TypeError is thrown when casting fails, this lead to a HTTP 500 error. Instead throw a proper InvalidArgumentError so the user receives a HTTP 400. Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
This commit is contained in:
parent
5862d5aea1
commit
e33fcfddc1
1 changed files with 7 additions and 1 deletions
|
|
@ -422,10 +422,16 @@ class FileSearchBackend implements ISearchBackend {
|
|||
$field = $this->mapPropertyNameToColumn($property);
|
||||
}
|
||||
|
||||
try {
|
||||
$castedValue = $this->castValue($property, $value ?? '');
|
||||
} catch (\Error $e) {
|
||||
throw new \InvalidArgumentException('Invalid property value for ' . $property->name, previous: $e);
|
||||
}
|
||||
|
||||
return new SearchComparison(
|
||||
$trimmedType,
|
||||
$field,
|
||||
$this->castValue($property, $value ?? ''),
|
||||
$castedValue,
|
||||
$extra ?? ''
|
||||
);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue