Merge pull request #51592 from nextcloud/fix/search-cast

fix(dav): throw invalid argument when property type does not match
This commit is contained in:
Ferdinand Thiessen 2025-04-29 13:41:48 +02:00 committed by GitHub
commit 698146c366
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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 ?? ''
);