Skip to content

Commit

Permalink
fix(tickets): unable to upload image in reply #500
Browse files Browse the repository at this point in the history
  • Loading branch information
polonel committed May 12, 2022
1 parent ea09c46 commit ddf2486
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/controllers/tickets.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
Expand Down

0 comments on commit ddf2486

Please sign in to comment.