Skip to content

Commit 4eaf565

Browse files
committed
fix: Correctly splitting filename into 'type' & 'name'
1 parent 453ba13 commit 4eaf565

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

server/services/main.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ module.exports = () => ({
168168

169169
await Promise.all(Object.keys(diff).map(async (file) => {
170170
const type = file.split('.')[0]; // Grab the first part of the filename.
171-
const name = file.split(/\.(.+)/)[1]; // Grab the rest of the filename minus the file extension.
171+
const name = file.split(/\.(.+)/)[1]; // Grab the rest of the filename.
172172

173173
if (configType && configType !== type) {
174174
return;
@@ -193,7 +193,7 @@ module.exports = () => ({
193193

194194
await Promise.all(Object.keys(diff).map(async (file) => {
195195
const type = file.split('.')[0]; // Grab the first part of the filename.
196-
const name = file.split(/\.(.+)/)[1]; // Grab the rest of the filename minus the file extension.
196+
const name = file.split(/\.(.+)/)[1]; // Grab the rest of the filename.
197197

198198
if (configType && configType !== type) {
199199
return;
@@ -215,7 +215,8 @@ module.exports = () => ({
215215
const shouldExclude = strapi.config.get('plugin.config-sync.exclude').includes(configName);
216216
if (shouldExclude) return;
217217

218-
const [type, name] = configName.split('.'); // Split the configName.
218+
const type = configName.split('.')[0]; // Grab the first part of the filename.
219+
const name = configName.split(/\.(.+)/)[1]; // Grab the rest of the filename.
219220
const fileContents = await strapi.plugin('config-sync').service('main').readConfigFile(type, name);
220221

221222
try {
@@ -240,7 +241,8 @@ module.exports = () => ({
240241
const shouldExclude = strapi.config.get('plugin.config-sync.exclude').includes(configName);
241242
if (shouldExclude) return;
242243

243-
const [type, name] = configName.split('.'); // Split the configName.
244+
const type = configName.split('.')[0]; // Grab the first part of the filename.
245+
const name = configName.split(/\.(.+)/)[1]; // Grab the rest of the filename.
244246

245247
try {
246248
await types(strapi)[type].exportSingle(configName);

0 commit comments

Comments
 (0)