mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-27 09:06:15 +01:00
fix: don't allow duplicate upgrade script names
This commit is contained in:
@@ -41,6 +41,23 @@ Upgrade.getAll = function (callback) {
|
|||||||
}));
|
}));
|
||||||
},
|
},
|
||||||
async.apply(Upgrade.appendPluginScripts),
|
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);
|
], callback);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user