mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-12 17:05:51 +01:00
prevent double res.send/json if error occurs in profile image upload
This commit is contained in:
@@ -176,8 +176,7 @@ var fs = require('fs'),
|
||||
user.setUserField(uid, 'picture', imageUrl);
|
||||
|
||||
if (convertToPNG && extension !== '.png') {
|
||||
im.convert([uploadPath, 'png:-'],
|
||||
function(err, stdout){
|
||||
im.convert([uploadPath, 'png:-'], function(err, stdout) {
|
||||
if (err) {
|
||||
winston.err(err);
|
||||
res.send({
|
||||
@@ -187,12 +186,15 @@ var fs = require('fs'),
|
||||
}
|
||||
|
||||
fs.writeFileSync(uploadPath, stdout, 'binary');
|
||||
});
|
||||
}
|
||||
|
||||
res.json({
|
||||
path: imageUrl
|
||||
});
|
||||
});
|
||||
} else {
|
||||
res.json({
|
||||
path: imageUrl
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
if(extension === '.gif') {
|
||||
|
||||
Reference in New Issue
Block a user