From ce7505532d15cdb5cb5f0a3fdcc510dd00c4b06b Mon Sep 17 00:00:00 2001 From: semiaddict Date: Wed, 5 May 2021 17:07:35 +0200 Subject: [PATCH] Do not export immutable fields --- services/core-store.js | 3 +++ services/role-permissions.js | 3 +++ services/webhooks.js | 3 +++ 3 files changed, 9 insertions(+) diff --git a/services/core-store.js b/services/core-store.js index 4bbf3eb..0fb1916 100644 --- a/services/core-store.js +++ b/services/core-store.js @@ -96,6 +96,9 @@ module.exports = { const shouldExclude = strapi.plugins['config-sync'].config.exclude.includes(`${configPrefix}.${key}`); if (shouldExclude) return; + // Do not export the _id field, as it is immutable + delete config._id; + configs[`${configPrefix}.${key}`] = { key, value: JSON.parse(value), ...config }; }); diff --git a/services/role-permissions.js b/services/role-permissions.js index 9511148..fe076b3 100644 --- a/services/role-permissions.js +++ b/services/role-permissions.js @@ -120,6 +120,9 @@ module.exports = { // Check if the config should be excluded. const shouldExclude = strapi.plugins['config-sync'].config.exclude.includes(`${configPrefix}.${config.type}`); if (shouldExclude) return; + + // Do not export the _id field, as it is immutable + delete config._id; configs[`${configPrefix}.${config.type}`] = config; }); diff --git a/services/webhooks.js b/services/webhooks.js index bb4c4ac..4fa2733 100644 --- a/services/webhooks.js +++ b/services/webhooks.js @@ -89,6 +89,9 @@ module.exports = { // Check if the config should be excluded. const shouldExclude = strapi.plugins['config-sync'].config.exclude.includes(`${configPrefix}.${config.id}`); if (shouldExclude) return; + + // Do not export the _id field, as it is immutable + delete config._id; configs[`${configPrefix}.${config.id}`] = config; });