Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FIX] Error when using Download My Data or Export My Data #14645

Merged
merged 3 commits into from
Jun 21, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions server/methods/requestDataDownload.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import fs from 'fs';
import path from 'path';

import mkdirp from 'mkdirp';
import { Meteor } from 'meteor/meteor';

import { ExportOperations } from '../../app/models';
Expand Down Expand Up @@ -33,22 +34,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 = {
Expand Down