diff --git a/back/tests.js b/back/tests.js index 38dcc6384..725aec6e4 100644 --- a/back/tests.js +++ b/back/tests.js @@ -60,7 +60,8 @@ async function test() { helpers: [], }); - jasmine.exitOnCompletion = false; + if (!isCI) jasmine.exitOnCompletion = false; + await jasmine.execute(); if (app) await app.disconnect(); if (container) await container.rm(); diff --git a/modules/invoiceOut/back/methods/invoiceOut/download.js b/modules/invoiceOut/back/methods/invoiceOut/download.js index 19dea5b1a..74f5c95fe 100644 --- a/modules/invoiceOut/back/methods/invoiceOut/download.js +++ b/modules/invoiceOut/back/methods/invoiceOut/download.js @@ -62,8 +62,14 @@ module.exports = Self => { name: fileName }; - await fs.access(file.path); - let stream = fs.createReadStream(file.path); + try { + await fs.access(file.path); + } catch (error) { + await Self.createPdf(ctx, id); + } + + const stream = fs.createReadStream(file.path); + return [stream, file.contentType, `filename="${file.name}"`]; } catch (error) { if (error.code === 'ENOENT')