fix: don't allow duplicate upgrade script names

v1.18.x
Barış Soner Uşaklı 5 years ago
parent f4c986a79a
commit 8887f0edaa

@ -41,6 +41,23 @@ Upgrade.getAll = function (callback) {
}));
},
async.apply(Upgrade.appendPluginScripts),
function (files, next) {
// check duplicates and error
const seen = {};
const dupes = [];
files.forEach((file) => {
if (seen[file]) {
dupes.push(file);
} else {
seen[file] = true;
}
});
if (dupes.length) {
winston.error('Found duplicate upgrade scripts\n' + dupes);
return next(new Error('[[error:duplicate-upgrade-scripts]]'));
}
setImmediate(next);
},
], callback);
};

Loading…
Cancel
Save