Skip to content

Commit

Permalink
fix: add support for Base64 in PickupRunner (#52)
Browse files Browse the repository at this point in the history
  • Loading branch information
FabioPinheiro authored May 3, 2023
1 parent 5a9a922 commit 4d81061
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions prism-agent/protocols/pickup/PickupRunner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@ export class PickupRunner {
if (Message.isBase64Attachment(attachment.data)) {
return {
attachmentId: attachment.id,
data: attachment.data.base64,
data: Buffer.from(attachment.data.base64, 'base64').toString('utf8'),
};
} else if (Message.isJsonAttachment(attachment.data)) {
return { attachmentId: attachment.id, data: attachment.data.data };
return { attachmentId: attachment.id, data: JSON.stringify(attachment.data.data) };
}

return null;
Expand All @@ -55,9 +55,7 @@ export class PickupRunner {
.filter(this.filterNullAttachments)
.map(async (attachment) => ({
attachmentId: attachment.attachmentId,
message: await this.mercury.unpackMessage(
JSON.stringify(attachment.data)
),
message: await this.mercury.unpackMessage(attachment.data),
}))
);
}
Expand Down

0 comments on commit 4d81061

Please sign in to comment.