From 0611b7e1eac8e25228bcd58fd78ffdbb5fde5787 Mon Sep 17 00:00:00 2001 From: psychobunny Date: Tue, 17 Feb 2015 15:12:31 -0500 Subject: [PATCH] closes #2733 --- src/controllers/admin/uploads.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/controllers/admin/uploads.js b/src/controllers/admin/uploads.js index 9ba3ad049c..81a98ed151 100644 --- a/src/controllers/admin/uploads.js +++ b/src/controllers/admin/uploads.js @@ -30,7 +30,7 @@ uploadsController.uploadFavicon = function(req, res, next) { var uploadedFile = req.files.files[0]; var allowedTypes = ['image/x-icon', 'image/vnd.microsoft.icon']; - if (validateUpload(res, req, next, uploadedFile, allowedTypes)) { + if (validateUpload(req, res, next, uploadedFile, allowedTypes)) { file.saveFileToLocal('favicon.ico', 'files', uploadedFile.path, function(err, image) { fs.unlink(uploadedFile.path); if (err) { @@ -63,7 +63,7 @@ function validateUpload(req, res, next, uploadedFile, allowedTypes) { if (allowedTypes.indexOf(uploadedFile.type) === -1) { fs.unlink(uploadedFile.path); - next(new Error('[[error:invalid-image-type, ' + allowedTypes.join(', ') + ']]')); + res.json({error: '[[error:invalid-image-type, ' + allowedTypes.join(', ') + ']]'}); return false; }