Recent searches
No recent searches
How to create a new blob from attachment.contentUrl on ZAF
Answered
Posted May 25, 2021
Hi everyone,
I was trying to use comment.attachments() to get the attachment file from the comment, however it doesn't return the real File, it's just return the details of the attached file.
So I am thinking to create a new File by making a new blob file from attachment.contentUrl(), but I can't get it since I got CORS error when I am trying to get it using the fetch function.
This is my code:
this.ticketObj = await parentClient.get('ticket')
const attachmentObject = this.ticketObj.ticket.comment.attachments
const blobFile = await fetch(attachmentObject[0].contentUrl).then(r => r.blob())
const uploadFile = new File([blobFile], attachmentObject[0].filename, { type: attachmentObject[0].contentType })
I got the CORS error on the blobFile.
Any idea what I am missing?
Thank You.
0
1
1 comment
Cheeny Aban
Hi avdnowhere,
We suggest that you check How can I troubleshoot CORS? as a guide in troubleshooting CORS errors.
All the best!
0