Skip to main content
Answer

context.downloadAttachment( ) returning broken file object

  • February 13, 2023
  • 1 reply
  • 122 views

Forum|alt.badge.img

Hi,

I’m building a plugin to save a message’s attachment and send it directly to a Google Drive. 

The problem I’m facing is that the context.downloadAttachment() function is returning a broken file: 

// attachments state contains message_id and attachment_id of all the conversation's attachments 

const handleAttachmentDownload = (index) => {
context.downloadAttachment(
attachments[index].messageData.id,
attachments[index].attachmentData.id
)
.then((resp) => {
console.log(resp)
setPreview(URL.createObjectURL(resp))
});
};

The promise is successfully returning a File

 

but as we try to handle the file (previewing or sending it to a google drive it for example) the resulting uploaded file is broken. 

Am I doing something wrong here? I’ve tested the exact same flow with a simple file input uploader and it works fine. 

Thanks

Best answer by Support Engineering

Hi Alex,

One of our support engineers is reaching out to troubleshoot this unexpected behavior.  Thank you!

1 reply

Forum|alt.badge.img+5

Hi Alex,

One of our support engineers is reaching out to troubleshoot this unexpected behavior.  Thank you!