This is minor fix for image upload issue if multiple sub directories to be created based on permaLink of product
parent
4739b59c1f
commit
1c09c0f7d4
|
@ -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
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue