From b0b2951ff62249721894252c8896989186c981f0 Mon Sep 17 00:00:00 2001 From: zadam Date: Tue, 22 Dec 2020 22:30:04 +0100 Subject: [PATCH] cleanup --- src/routes/api/export.js | 4 ---- src/services/export/zip.js | 7 +++---- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/src/routes/api/export.js b/src/routes/api/export.js index a2877e3d2..de905d0cd 100644 --- a/src/routes/api/export.js +++ b/src/routes/api/export.js @@ -23,11 +23,7 @@ function exportBranch(req, res) { try { if (type === 'subtree' && (format === 'html' || format === 'markdown')) { - const start = Date.now(); - zipExportService.exportToZip(taskContext, branch, format, res); - - console.log("Export took", Date.now() - start, "ms"); } else if (type === 'single') { singleExportService.exportSingleNote(taskContext, branch, format, res); diff --git a/src/services/export/zip.js b/src/services/export/zip.js index 5346dbbee..5c7376f34 100644 --- a/src/services/export/zip.js +++ b/src/services/export/zip.js @@ -143,7 +143,7 @@ function exportToZip(taskContext, branch, format, res) { const available = !note.isProtected || protectedSessionService.isProtectedSessionAvailable(); // if it's a leaf then we'll export it even if it's empty - if (available && ((note.getContent()).length > 0 || childBranches.length === 0)) { + if (available && (note.getContent().length > 0 || childBranches.length === 0)) { meta.dataFileName = getDataFileName(note, baseFileName, existingFileNames); } @@ -433,14 +433,13 @@ ${content} } const note = branch.getNote(); - const zipFileName = (branch.prefix ? (branch.prefix + " - ") : "") + note.title + ".zip"; + const zipFileName = (branch.prefix ? `${branch.prefix} - ` : "") + note.title + ".zip"; res.setHeader('Content-Disposition', utils.getContentDisposition(zipFileName)); res.setHeader('Content-Type', 'application/zip'); - zipFile.end(); - zipFile.outputStream.pipe(res); + zipFile.end(); taskContext.taskSucceeded(); }