From 74a5a70969270e07af6498abb48488182bc0af5a Mon Sep 17 00:00:00 2001 From: Ben Lubar <ben.lubar@gmail.com> Date: Thu, 21 Apr 2016 15:54:23 -0500 Subject: [PATCH] fix convert-avatars-to-png option not being honored --- src/user/picture.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/user/picture.js b/src/user/picture.js index c9a760f10e..a55eee2975 100644 --- a/src/user/picture.js +++ b/src/user/picture.js @@ -57,11 +57,13 @@ module.exports = function(User) { }, next); }, function(next) { - if (convertToPNG) { - image.normalise(picture.path, extension, next); - } else { - next(); + if (!convertToPNG) { + return next(); } + async.series([ + async.apply(image.normalise, picture.path, extension), + async.apply(fs.rename, picture.path + '.png', picture.path) + ], next); }, function(next) { User.getUserField(updateUid, 'uploadedpicture', next); @@ -225,4 +227,4 @@ module.exports = function(User) { User.removeCoverPicture = function(data, callback) { db.deleteObjectField('user:' + data.uid, 'cover:url', callback); }; -}; \ No newline at end of file +};