From 921460db4031134db863e32101c0ad60a17416b5 Mon Sep 17 00:00:00 2001 From: Romulus Urakagi Tsai Date: Fri, 22 May 2020 14:59:56 +0800 Subject: [PATCH] Fix export attachments (not tested) --- models/export.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/models/export.js b/models/export.js index 35e558048..1eb47e54c 100644 --- a/models/export.js +++ b/models/export.js @@ -146,7 +146,7 @@ export class Exporter { `tmpexport${process.pid}${Math.random()}`, ); const tmpWriteable = fs.createWriteStream(tmpFile); - const readStream = doc.createReadStream(); + const readStream = fs.createReadStream(doc.path); readStream.on('data', function(chunk) { buffer = Buffer.concat([buffer, chunk]); }); @@ -173,11 +173,11 @@ export class Exporter { return { _id: attachment._id, - cardId: attachment.cardId, + cardId: attachment.meta.cardId, //url: FlowRouter.url(attachment.url()), file: filebase64, - name: attachment.original.name, - type: attachment.original.type, + name: attachment.name, + type: attachment.type, }; });