mirror of
https://github.com/strapi/strapi.git
synced 2025-10-30 01:17:28 +00:00
Fix sanitze-entity components missing
This commit is contained in:
parent
60cbb448f6
commit
c9f1cc6977
@ -48,9 +48,9 @@ const sanitizeEntity = (dataSource, options) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Relations
|
// Relations
|
||||||
const isRelation = attribute && attribute.type === 'relation';
|
const isRelation = attribute && ['relation', 'component'].includes(attribute.type);
|
||||||
if (isRelation) {
|
if (isRelation) {
|
||||||
const relation = attribute && attribute.target;
|
const relation = attribute && (attribute.target || attribute.component);
|
||||||
|
|
||||||
if (_.isNil(value)) {
|
if (_.isNil(value)) {
|
||||||
return { ...acc, [key]: value };
|
return { ...acc, [key]: value };
|
||||||
@ -128,7 +128,8 @@ const getAllowedFields = ({ includeFields, model, isOutput }) => {
|
|||||||
|
|
||||||
const nonVisibleWritableAttributes = _.intersection(writableAttributes, nonVisibleAttributes);
|
const nonVisibleWritableAttributes = _.intersection(writableAttributes, nonVisibleAttributes);
|
||||||
|
|
||||||
return _.concat(
|
return _.uniq(
|
||||||
|
_.concat(
|
||||||
includeFields || [],
|
includeFields || [],
|
||||||
...(isOutput
|
...(isOutput
|
||||||
? [
|
? [
|
||||||
@ -140,6 +141,7 @@ const getAllowedFields = ({ includeFields, model, isOutput }) => {
|
|||||||
...nonVisibleAttributes,
|
...nonVisibleAttributes,
|
||||||
]
|
]
|
||||||
: [STATIC_FIELDS, COMPONENT_FIELDS, ...nonVisibleWritableAttributes])
|
: [STATIC_FIELDS, COMPONENT_FIELDS, ...nonVisibleWritableAttributes])
|
||||||
|
)
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user