Solved

context.downloadAttachment( ) returning broken file object

  • 13 February 2023
  • 1 reply
  • 101 views

Badge

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

icon

Best answer by Support Engineering 14 February 2023, 21:56

View original

1 reply

Userlevel 1
Badge +5

Hi Alex,

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

Reply