Merge pull request #52 from boazpoolman/fix/warning-for-missing-data
Gracefully warn about corrupt datapull/58/head
commit
2adc044c9a
|
@ -183,6 +183,12 @@ const ConfigType = class ConfigType {
|
|||
await Promise.all(Object.values(AllConfig).map(async (config) => {
|
||||
const combinedUid = getCombinedUid(this.uidKeys, config);
|
||||
const combinedUidWhereFilter = getCombinedUidWhereFilter(this.uidKeys, config);
|
||||
|
||||
if (!combinedUid) {
|
||||
strapi.log.warn(logMessage(`Missing data for entity with id ${config.id} of type ${this.configPrefix}`));
|
||||
return;
|
||||
}
|
||||
|
||||
// Check if the config should be excluded.
|
||||
const shouldExclude = !isEmpty(strapi.config.get('plugin.config-sync.excludedConfig').filter((option) => `${this.configPrefix}.${combinedUid}`.startsWith(option)));
|
||||
if (shouldExclude) return;
|
||||
|
|
|
@ -4,6 +4,7 @@ const { isEmpty } = require('lodash');
|
|||
const fs = require('fs');
|
||||
const util = require('util');
|
||||
const difference = require('../utils/getObjectDiff');
|
||||
const { logMessage } = require('../utils');
|
||||
|
||||
/**
|
||||
* Main services for config import/export.
|
||||
|
@ -118,6 +119,12 @@ module.exports = () => ({
|
|||
}
|
||||
|
||||
const fileContents = await strapi.plugin('config-sync').service('main').readConfigFile(type, name);
|
||||
|
||||
if (!fileContents) {
|
||||
strapi.log.warn(logMessage(`An empty config file '${file}' was found in the sync directory`));
|
||||
return;
|
||||
}
|
||||
|
||||
fileConfigs[`${type}.${formattedName}`] = fileContents;
|
||||
}));
|
||||
|
||||
|
|
Loading…
Reference in New Issue