mirror of
https://github.com/strapi/strapi.git
synced 2025-11-02 02:44:55 +00:00
Don't mutate the original filters object
This commit is contained in:
parent
d551b2c078
commit
9fbe72d58a
@ -4,7 +4,7 @@
|
||||
* Converts the standard Strapi REST query params to a more usable format for querying
|
||||
* You can read more here: https://docs.strapi.io/developer-docs/latest/developer-resources/database-apis-reference/rest-api.html#filters
|
||||
*/
|
||||
const { has, isEmpty, isObject } = require('lodash/fp');
|
||||
const { has, isEmpty, isObject, cloneDeep } = require('lodash/fp');
|
||||
const _ = require('lodash');
|
||||
const parseType = require('./parse-type');
|
||||
const contentTypesUtils = require('./content-types');
|
||||
@ -287,7 +287,10 @@ const convertFiltersQueryParams = (filters, schema) => {
|
||||
return filters;
|
||||
};
|
||||
|
||||
return sanitizeFilters(filters, schema);
|
||||
// Don't mutate the original object
|
||||
const filtersCopy = cloneDeep(filters);
|
||||
|
||||
return sanitizeFilters(filtersCopy, schema);
|
||||
};
|
||||
|
||||
const convertPublicationStateParams = (type, params = {}, query = {}) => {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user