Skip to content

Commit

Permalink
fix(attachments): failed to upload on docker
Browse files Browse the repository at this point in the history
  • Loading branch information
polonel committed Jan 1, 2019
1 parent 82d5332 commit 36a5bcb
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/controllers/tickets.js
Original file line number Diff line number Diff line change
Expand Up @@ -473,7 +473,7 @@ ticketsController.single = function(req, res) {
};

ticketsController.uploadAttachment = function(req, res) {
var fs = require('fs');
var fs = require('fs-extra');
var Busboy = require('busboy');
var busboy = new Busboy({
headers: req.headers,
Expand Down Expand Up @@ -511,7 +511,7 @@ ticketsController.uploadAttachment = function(req, res) {
var savePath = path.join(__dirname, '../../public/uploads/tickets', object.ticketId);
var sanitizedFilename = filename.replace(/[^a-z0-9.]/gi, '_').toLowerCase();

if (!fs.existsSync(savePath)) fs.mkdirSync(savePath);
if (!fs.existsSync(savePath)) fs.ensureDirSync(savePath);

object.filePath = path.join(savePath, 'attachment_' + sanitizedFilename);
object.filename = sanitizedFilename;
Expand Down

0 comments on commit 36a5bcb

Please sign in to comment.