Skip to content

Commit a44db27

Browse files
committed
fix: Warn about an empty config file
1 parent f4d689e commit a44db27

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

server/services/main.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ const { isEmpty } = require('lodash');
44
const fs = require('fs');
55
const util = require('util');
66
const difference = require('../utils/getObjectDiff');
7+
const { logMessage } = require('../utils');
78

89
/**
910
* Main services for config import/export.
@@ -118,6 +119,12 @@ module.exports = () => ({
118119
}
119120

120121
const fileContents = await strapi.plugin('config-sync').service('main').readConfigFile(type, name);
122+
123+
if (!fileContents) {
124+
strapi.log.warn(logMessage(`An empty config file '${file}' was found in the sync directory`));
125+
return;
126+
}
127+
121128
fileConfigs[`${type}.${formattedName}`] = fileContents;
122129
}));
123130

0 commit comments

Comments
 (0)