diff --git a/packages/core/content-manager/server/services/entity-manager.js b/packages/core/content-manager/server/services/entity-manager.js index 2d3d430814..df4b28ee4a 100644 --- a/packages/core/content-manager/server/services/entity-manager.js +++ b/packages/core/content-manager/server/services/entity-manager.js @@ -212,7 +212,12 @@ module.exports = ({ strapi }) => ({ } // validate the entity is valid for publication - await strapi.entityValidator.validateEntityCreation(strapi.getModel(uid), entity); + await strapi.entityValidator.validateEntityCreation( + strapi.getModel(uid), + entity, + undefined, + entity + ); const data = { ...body, [PUBLISHED_AT_ATTRIBUTE]: new Date() }; diff --git a/packages/core/strapi/lib/services/entity-validator/validators.js b/packages/core/strapi/lib/services/entity-validator/validators.js index ef039eb676..ac3c117c15 100644 --- a/packages/core/strapi/lib/services/entity-validator/validators.js +++ b/packages/core/strapi/lib/services/entity-validator/validators.js @@ -127,7 +127,7 @@ const addUniqueValidator = (validator, { attr, model, updatedAttribute, entity } * If the attribute value is `null` we want to skip the unique validation. * Otherwise it'll only accept a single `null` entry in the database. */ - if (updatedAttribute.value === null) { + if (_.isNil(updatedAttribute.value)) { return true; }