Skip to content

Commit

Permalink
fix: don't allow duplicate upgrade script names
Browse files Browse the repository at this point in the history
  • Loading branch information
barisusakli committed Aug 7, 2020
1 parent f4c986a commit 8887f0e
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/upgrade.js
Expand Up @@ -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);
};

Expand Down

0 comments on commit 8887f0e

Please sign in to comment.