From d861f044a3365c34f66319015b8e42c16e5aa826 Mon Sep 17 00:00:00 2001 From: Chris Brame Date: Thu, 12 May 2022 19:30:23 -0400 Subject: [PATCH] fix(tickets): error when uploading attachments #500 --- src/controllers/tickets.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/controllers/tickets.js b/src/controllers/tickets.js index 97d061e37..db1cdb6c8 100644 --- a/src/controllers/tickets.js +++ b/src/controllers/tickets.js @@ -641,7 +641,7 @@ ticketsController.uploadImageMDE = function (req, res) { ticketsController.uploadAttachment = function (req, res) { const fs = require('fs-extra') const Busboy = require('busboy') - const busboy = new Busboy({ + const busboy = Busboy({ headers: req.headers, limits: { files: 1, @@ -659,8 +659,9 @@ ticketsController.uploadAttachment = function (req, res) { if (fieldname === 'ownerId') object.ownerId = val }) - busboy.on('file', function (fieldname, file, filename, encoding, mimetype) { - // winston.debug(mimetype); + busboy.on('file', function (name, file, info) { + const filename = info.filename + const mimetype = info.mimeType if ( mimetype.indexOf('image/') === -1 &&