Skip to content

Commit 698146c

Browse files
authored
Merge pull request #51592 from nextcloud/fix/search-cast
fix(dav): throw invalid argument when property type does not match
2 parents 9df998e + e33fcfd commit 698146c

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

apps/dav/lib/Files/FileSearchBackend.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -422,10 +422,16 @@ private function transformSearchOperation(Operator $operator) {
422422
$field = $this->mapPropertyNameToColumn($property);
423423
}
424424

425+
try {
426+
$castedValue = $this->castValue($property, $value ?? '');
427+
} catch (\Error $e) {
428+
throw new \InvalidArgumentException('Invalid property value for ' . $property->name, previous: $e);
429+
}
430+
425431
return new SearchComparison(
426432
$trimmedType,
427433
$field,
428-
$this->castValue($property, $value ?? ''),
434+
$castedValue,
429435
$extra ?? ''
430436
);
431437

0 commit comments

Comments
 (0)