From c559a998aa7e7ba0559b84d3f7c1b32f516d2ffa Mon Sep 17 00:00:00 2001 From: Fabio Cigliano Date: Thu, 30 Aug 2018 16:44:26 +0200 Subject: [PATCH] minor fixes --- lib/customers.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/customers.js b/lib/customers.js index 089e7e16..fb46ef1f 100644 --- a/lib/customers.js +++ b/lib/customers.js @@ -349,7 +349,7 @@ function updatePhotoCard (id, patch) { return Promise.resolve(patch) .then(patch => { // Base64 encoded image /9j/4AAQSkZJRgABAQAAAQ.. - let imageData = _.get('idCardPhotoData', patch) + const imageData = _.get('idCardPhotoData', patch) if (_.isEmpty(imageData)) { return patch @@ -359,7 +359,7 @@ function updatePhotoCard (id, patch) { const newPatch = _.omit('idCardPhotoData', patch) // decode the base64 string to binary data - imageData = Buffer.from(imageData, 'base64') + const decodedImageData = Buffer.from(imageData, 'base64') // workout the image hash // i.e. 240e85ff2e4bb931f235985dd0134e459239496d2b5af6c5665168d38ef89b50 @@ -390,7 +390,7 @@ function updatePhotoCard (id, patch) { newPatch.idCardPhotoAt = 'now()' // write image file - return writeFile(filename, imageData) + return writeFile(filename, decodedImageData) .then(() => newPatch) }) }