From ddf2486d0da951199885ab4415e6149751e0a729 Mon Sep 17 00:00:00 2001 From: Chris Brame Date: Thu, 12 May 2022 18:09:13 -0400 Subject: [PATCH] fix(tickets): unable to upload image in reply #500 --- src/controllers/tickets.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/controllers/tickets.js b/src/controllers/tickets.js index 729a4df1a..97d061e37 100644 --- a/src/controllers/tickets.js +++ b/src/controllers/tickets.js @@ -533,7 +533,7 @@ ticketsController.uploadImageMDE = function (req, res) { const chance = new Chance() const fs = require('fs-extra') const Busboy = require('busboy') - const busboy = new Busboy({ + const busboy = Busboy({ headers: req.headers, limits: { files: 1, @@ -547,7 +547,9 @@ ticketsController.uploadImageMDE = function (req, res) { object.ticketId = req.headers.ticketid if (!object.ticketId) return res.status(400).json({ success: false }) - busboy.on('file', function (fieldname, file, filename, encoding, mimetype) { + busboy.on('file', function (name, file, info) { + const filename = info.filename + const mimetype = info.mimeType if (mimetype.indexOf('image/') === -1) { error = { status: 500,