From 2ea2d52a1ba184f87739abb448063069ceef1296 Mon Sep 17 00:00:00 2001 From: Pierre Date: Mon, 27 May 2019 13:49:04 -0300 Subject: [PATCH 1/2] Use mkdirp instead of fs.mkdir --- server/methods/requestDataDownload.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/server/methods/requestDataDownload.js b/server/methods/requestDataDownload.js index 604d68c72ec9..1f7d4fe5681b 100644 --- a/server/methods/requestDataDownload.js +++ b/server/methods/requestDataDownload.js @@ -6,6 +6,8 @@ import { Meteor } from 'meteor/meteor'; import { ExportOperations } from '../../app/models'; import { settings } from '../../app/settings'; +import mkdirp from 'mkdirp'; + let tempFolder = '/tmp/userData'; if (settings.get('UserData_FileSystemPath') != null) { if (settings.get('UserData_FileSystemPath').trim() !== '') { @@ -33,22 +35,22 @@ Meteor.methods({ } if (!fs.existsSync(tempFolder)) { - fs.mkdirSync(tempFolder); + mkdirp.sync(tempFolder); } const subFolderName = fullExport ? 'full' : 'partial'; const baseFolder = path.join(tempFolder, userId); if (!fs.existsSync(baseFolder)) { - fs.mkdirSync(baseFolder); + mkdirp.sync(baseFolder); } const folderName = path.join(baseFolder, subFolderName); if (!fs.existsSync(folderName)) { - fs.mkdirSync(folderName); + mkdirp.sync(folderName); } const assetsFolder = path.join(folderName, 'assets'); if (!fs.existsSync(assetsFolder)) { - fs.mkdirSync(assetsFolder); + mkdirp.sync(assetsFolder); } const exportOperation = { From d766420ff3fe42e99d09207f8a0e573592bd6562 Mon Sep 17 00:00:00 2001 From: Pierre Date: Mon, 27 May 2019 21:32:38 -0300 Subject: [PATCH 2/2] Fixed Import Order --- server/methods/requestDataDownload.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/server/methods/requestDataDownload.js b/server/methods/requestDataDownload.js index 1f7d4fe5681b..38bad4dbc003 100644 --- a/server/methods/requestDataDownload.js +++ b/server/methods/requestDataDownload.js @@ -1,13 +1,12 @@ import fs from 'fs'; import path from 'path'; +import mkdirp from 'mkdirp'; import { Meteor } from 'meteor/meteor'; import { ExportOperations } from '../../app/models'; import { settings } from '../../app/settings'; -import mkdirp from 'mkdirp'; - let tempFolder = '/tmp/userData'; if (settings.get('UserData_FileSystemPath') != null) { if (settings.get('UserData_FileSystemPath').trim() !== '') {