mirror of
https://github.com/strapi/strapi.git
synced 2025-12-28 07:33:17 +00:00
Update isNumeric function with Object type check.
Fix false positive of isNumeric function in order to allow where query on nested object in graphql.
This commit is contained in:
parent
6a24021a2a
commit
73fb19ca0f
@ -12,7 +12,7 @@ const _ = require('lodash');
|
||||
|
||||
// Following this discussion https://stackoverflow.com/questions/18082/validate-decimal-numbers-in-javascript-isnumeric this function is the best implem to determine if a value is a valid number candidate
|
||||
const isNumeric = (value) => {
|
||||
return !isNaN(parseFloat(value)) && isFinite(value);
|
||||
return !_.isObject(value) && !isNaN(parseFloat(value)) && isFinite(value);
|
||||
};
|
||||
|
||||
/* eslint-disable prefer-template */
|
||||
@ -466,7 +466,7 @@ module.exports = {
|
||||
// Remove the filter keyword at the end
|
||||
let splitKey = key.split('_').slice(0,-1);
|
||||
splitKey = splitKey.join('_');
|
||||
|
||||
|
||||
if (modelAttributes[splitKey]) {
|
||||
fieldType = modelAttributes[splitKey]['type'];
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user