This commit is contained in:
Julian Lam
2016-02-09 09:45:11 -05:00
parent 2ce64726ba
commit 3a6ad52ac8
3 changed files with 16 additions and 4 deletions

View File

@@ -168,6 +168,9 @@ module.exports = function(User) {
}, next);
},
function(next) {
file.isFileTypeAllowed(tempPath, next);
},
function(tempPath, next) {
var image = {
name: 'profileCover',
path: data.file ? data.file.path : tempPath,
@@ -204,7 +207,9 @@ module.exports = function(User) {
}
], function(err) {
if (err) {
return callback(err);
return fs.unlink(tempPath, function(unlinkErr) {
callback(err); // send back the original error
});
}
if (data.position) {