fix: use 'file' field name with proper MIME type for attach endpoint

This commit is contained in:
jramos
2026-04-13 14:07:13 -06:00
parent 6cb65fddc1
commit d64eb7eec4
2 changed files with 5 additions and 5 deletions

View File

@@ -109,11 +109,11 @@ function ivantiFormPost(urlPath, fields, files, apiKey, skipTls) {
}
// File fields
for (const { name, buffer, filename } of files) {
for (const { name, buffer, filename, contentType } of files) {
parts.push(Buffer.from(
`--${boundary}\r\n` +
`Content-Disposition: form-data; name="${name}"; filename="${filename}"\r\n` +
`Content-Type: application/octet-stream\r\n\r\n`
`Content-Type: ${contentType || 'application/octet-stream'}\r\n\r\n`
));
parts.push(buffer);
parts.push(Buffer.from('\r\n'));