diff --git a/server-node/src/routes/api/workflow-controller.ts b/server-node/src/routes/api/workflow-controller.ts index ec91cdd40..aad76c5e5 100644 --- a/server-node/src/routes/api/workflow-controller.ts +++ b/server-node/src/routes/api/workflow-controller.ts @@ -190,7 +190,7 @@ router.get("/result/:workflowUuid", async (req: Request, res: Response) => { /* * If workflow isn't done return error - * Send file, TODO: if there are multiple outputs return as zip + * Send file, if there are multiple outputs return as zip * If download is done, delete results / allow deletion within the next 5-60 mins */ const workflow = activeWorkflows[req.params.workflowUuid]; diff --git a/server-node/src/utils/endpoint-utils.ts b/server-node/src/utils/endpoint-utils.ts index 0d78f0a91..d39c07875 100644 --- a/server-node/src/utils/endpoint-utils.ts +++ b/server-node/src/utils/endpoint-utils.ts @@ -45,17 +45,15 @@ export async function respondWithZip(res: Response, filename: string, files: {ui console.log("Sent"); } -export async function respondWithPdfFiles(res: Response, pdfFiles: PdfFile|PdfFile[], filename: string) { - const pdfResults = Array.isArray(pdfFiles) ? pdfFiles : [pdfFiles]; - - if(pdfResults.length == 0) { +export async function respondWithPdfFiles(res: Response, pdfFiles: PdfFile[] | undefined, filename: string) { + if(!pdfFiles || pdfFiles.length == 0) { res.status(500).json({"warning": "The workflow had no outputs."}); } - else if (pdfResults.length == 1) { - respondWithPdfFile(res, pdfResults[0]) + else if (pdfFiles.length == 1) { + respondWithPdfFile(res, pdfFiles[0]) } else { - const promises = pdfResults.map(async (pdf) => {return{uint8Array: await pdf.uint8Array, filename: pdf.filename + ".pdf"}}) + const promises = pdfFiles.map(async (pdf) => {return{uint8Array: await pdf.uint8Array, filename: pdf.filename + ".pdf"}}) const files = await Promise.all(promises); respondWithZip(res, filename, files); } diff --git a/shared-operations/declarations/Action.d.ts b/shared-operations/declarations/Action.d.ts index d2d4ec1b2..de5bd74c5 100644 --- a/shared-operations/declarations/Action.d.ts +++ b/shared-operations/declarations/Action.d.ts @@ -1,5 +1,5 @@ export interface Action { - protected values: any; + values: any; type: string; actions?: Action[]; }