minor fixes
This commit is contained in:
parent
afc78d512e
commit
c559a998aa
1 changed files with 3 additions and 3 deletions
|
|
@ -349,7 +349,7 @@ function updatePhotoCard (id, patch) {
|
||||||
return Promise.resolve(patch)
|
return Promise.resolve(patch)
|
||||||
.then(patch => {
|
.then(patch => {
|
||||||
// Base64 encoded image /9j/4AAQSkZJRgABAQAAAQ..
|
// Base64 encoded image /9j/4AAQSkZJRgABAQAAAQ..
|
||||||
let imageData = _.get('idCardPhotoData', patch)
|
const imageData = _.get('idCardPhotoData', patch)
|
||||||
|
|
||||||
if (_.isEmpty(imageData)) {
|
if (_.isEmpty(imageData)) {
|
||||||
return patch
|
return patch
|
||||||
|
|
@ -359,7 +359,7 @@ function updatePhotoCard (id, patch) {
|
||||||
const newPatch = _.omit('idCardPhotoData', patch)
|
const newPatch = _.omit('idCardPhotoData', patch)
|
||||||
|
|
||||||
// decode the base64 string to binary data
|
// decode the base64 string to binary data
|
||||||
imageData = Buffer.from(imageData, 'base64')
|
const decodedImageData = Buffer.from(imageData, 'base64')
|
||||||
|
|
||||||
// workout the image hash
|
// workout the image hash
|
||||||
// i.e. 240e85ff2e4bb931f235985dd0134e459239496d2b5af6c5665168d38ef89b50
|
// i.e. 240e85ff2e4bb931f235985dd0134e459239496d2b5af6c5665168d38ef89b50
|
||||||
|
|
@ -390,7 +390,7 @@ function updatePhotoCard (id, patch) {
|
||||||
newPatch.idCardPhotoAt = 'now()'
|
newPatch.idCardPhotoAt = 'now()'
|
||||||
|
|
||||||
// write image file
|
// write image file
|
||||||
return writeFile(filename, imageData)
|
return writeFile(filename, decodedImageData)
|
||||||
.then(() => newPatch)
|
.then(() => newPatch)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue