mirror of
https://github.com/nextcloud/server.git
synced 2026-06-15 11:41:20 -04:00
fix(metadata): properly handle casting non-numeric values in search operations with custom metadata
If a metadata property is declared with a number type but the value provided are not numeric, it
logs "A non-numeric value encountered at nextcloud/apps/dav/lib/Files/FileSearchBackend.php#486" instead of throwing a proper error.
Now with a proper error we have the proper exception being thrown: InvalidArgumentException Invalid
property value for {http://nextcloud.org/ns}metadata-photos-original_date_time
Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
parent
0c6e396394
commit
974cfef214
1 changed files with 4 additions and 1 deletions
|
|
@ -482,7 +482,10 @@ class FileSearchBackend implements ISearchBackend {
|
|||
case SearchPropertyDefinition::DATATYPE_DECIMAL:
|
||||
case SearchPropertyDefinition::DATATYPE_INTEGER:
|
||||
case SearchPropertyDefinition::DATATYPE_NONNEGATIVE_INTEGER:
|
||||
return 0 + $value;
|
||||
if (is_numeric($value)) {
|
||||
return 0 + $value;
|
||||
}
|
||||
throw new \Error('Value for numeric datatype is not numeric');
|
||||
case SearchPropertyDefinition::DATATYPE_DATETIME:
|
||||
if (is_numeric($value)) {
|
||||
return max(0, 0 + $value);
|
||||
|
|
|
|||
Loading…
Reference in a new issue