Skip to content

Commit

Permalink
fix: parsing of payload to json
Browse files Browse the repository at this point in the history
  • Loading branch information
LinHuiqing committed Sep 19, 2023
1 parent 682eb0c commit 4371c0d
Showing 1 changed file with 13 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -226,19 +226,26 @@ export const scanAttachments = async (
req.body.responses.map((response) => {
if (isQuarantinedAttachmentResponse(response)) {
return triggerVirusScanning(response.answer).map((data) => {
const returnPayload = JSON.parse(
Buffer.from(data?.Payload ?? '').toString(),
) as {
statusCode: number
body: {
message: string
cleanFileKey: string
destinationVersionId: string
}
}
logger.info({
message: 'Successfully invoked lambda function',
meta: {
...logMeta,
responseMetadata: data?.$metadata,
returnPayload: Buffer.from(data?.Payload ?? '').toString(),
logResult: Buffer.from(
data?.LogResult ?? '',
'base64',
).toString(),
statusCode: data?.StatusCode,
returnPayload,
},
})
return okAsync(true)
return okAsync(returnPayload)
})
}
return okAsync(true)
Expand Down

0 comments on commit 4371c0d

Please sign in to comment.