From 1c09c0f7d44143aa910313bd1301a61810bfe5b2 Mon Sep 17 00:00:00 2001 From: Shreyas Date: Sun, 23 Dec 2018 15:03:09 +0530 Subject: [PATCH] This is minor fix for image upload issue if multiple sub directories to be created based on permaLink of product --- lib/common.js | 6 ++++++ 1 file changed, 6 insertions(+) mode change 100644 => 100755 lib/common.js diff --git a/lib/common.js b/lib/common.js old mode 100644 new mode 100755 index fb230d8..7ffc4d7 --- a/lib/common.js +++ b/lib/common.js @@ -10,6 +10,7 @@ const async = require('async'); const nodemailer = require('nodemailer'); const sanitizeHtml = require('sanitize-html'); const escape = require('html-entities').AllHtmlEntities; +const mkdirp = require('mkdirp'); let ObjectId = require('mongodb').ObjectID; const restrictedRoutes = [ @@ -177,7 +178,12 @@ exports.checkDirectorySync = (directory) => { try{ fs.statSync(directory); }catch(e){ + try{ fs.mkdirSync(directory); + } + catch(err){ + mkdirp.sync(directory);//error : directory & sub directories to be newly created + } } };