Hello.
I'm trying to send an attachment from my Freshdesk application to an Jira issue using the following code:
var fileAttachment = {
file: {
value: attachment,
options: {
filename: file.name,
contentType: null
}
}
};
var optionsAttachment = {
headers: {
'Authorization': 'Basic ' + btoa(jiraUser + ':' + jiraPass),
// 'Content-Disposition': `form-data; name="file"; filename="${file.name}"; Content-Type: ${file.type}`,
'Content-Type': `multipart/form-data; file=@${file.name}`,
'X-Atlassian-Token': 'nocheck'
},
formData: fileAttachment
};
var url = `${jiraUrl}/rest/api/3/issue/${jiraIssueId}/attachments`;
console.log(url);
client.request.post(url, optionsAttachment /*, { headers: optionsAttachment.headers }*/).then(function (dataIssue) {
resolve(dataIssue);
}, function (err) {
reject(err);
});
The client.request.post is a functionality of Freshdesk SDK to make http calls.
Using this code, the file is sent to Jira, but when I open that file, it shows the following error:
Can anyone help me in this case?
Thank you.