diff --git a/apps/dav/lib/Files/FileSearchBackend.php b/apps/dav/lib/Files/FileSearchBackend.php index 1b7859621129b..ace367e4490d6 100644 --- a/apps/dav/lib/Files/FileSearchBackend.php +++ b/apps/dav/lib/Files/FileSearchBackend.php @@ -422,10 +422,16 @@ private function transformSearchOperation(Operator $operator) { $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 ?? '' );