diff --git a/core/server/controllers/admin.js b/core/server/controllers/admin.js index 36d97de7cd..9a3d94fc96 100644 --- a/core/server/controllers/admin.js +++ b/core/server/controllers/admin.js @@ -317,11 +317,18 @@ adminControllers = { }); }, 'import': function (req, res) { - if (!req.files.importfile) { - // Notify of an error if it occurs + if (!req.files.importfile || req.files.importfile.size === 0 || req.files.importfile.name.indexOf('json') === -1) { + /** + * Notify of an error if it occurs + * + * - If there's no file (although if you don't select anything, the input is still submitted, so + * !req.files.importfile will always be false) + * - If the size is 0 + * - If the name doesn't have json in it + */ var notification = { type: 'error', - message: "Must select a file to import", + message: "Must select a .json file to import", status: 'persistent', id: 'per-' + (ghost.notifications.length + 1) };