Attachment that was uploaded via Jira API is malformed

Hi,

I’ve asked this question a few days ago, but I didn’t get a decent answer for it. Since you are typically do not answer more than once on the same topic, I have to create a new one.

I’m trying to upload an attachment to a specific issue in my Custom UI app.
I’m using this endpoint in the Jira API.

I tried to upload it using resolve from @forge/bridge , but it doesn’t work. I saw here in the forum that someone suggested using the requestJira option. This option works fine for text files, but when I try to upload an image/pdf/etc, the file is uploaded but it’s corrupted. When I download the attachment and compare it with the original file that I uploaded, I can see that something is wrong with its encoding.

This is how I’m uploading the attachment:

const form = new FormData();

attachments.forEach((attachment) => {
	form.append('file', attachment, attachment.name);
});

const response = await requestJira(`/rest/api/2/issue/AP-9/attachments`, {
	method: 'POST',
	body: form,
	headers: {
		Accept: 'application/json',
		'X-Atlassian-Token': 'no-check'
	}
});

This is the original post: Corrupted attachment file is uploaded

This issue has been reported in the past and such a basic functionality must work. Please help me to solve this huge blocker.

Thanks,
Amit

1 Like

From what I can tell, this is now captured in: [FRGE-635] - Ecosystem Jira

Please watch, comment, and vote there.