diff --git a/loopback/locale/en.json b/loopback/locale/en.json index 46b48e2ea..30b0664b5 100644 --- a/loopback/locale/en.json +++ b/loopback/locale/en.json @@ -185,5 +185,6 @@ "You don't have enough privileges.": "You don't have enough privileges.", "This ticket is locked.": "This ticket is locked.", "This ticket is not editable.": "This ticket is not editable.", - "The ticket doesn't exist.": "The ticket doesn't exist." + "The ticket doesn't exist.": "The ticket doesn't exist.", + "The response is not a PDF": "The response is not a PDF" } diff --git a/loopback/locale/es.json b/loopback/locale/es.json index 195b683ad..1cfcf2f83 100644 --- a/loopback/locale/es.json +++ b/loopback/locale/es.json @@ -315,5 +315,6 @@ "This ticket is not editable.": "Este ticket no es editable.", "The ticket doesn't exist.": "No existe el ticket.", "Social name should be uppercase": "La razón social debe ir en mayúscula", - "Street should be uppercase": "La dirección fiscal debe ir en mayúscula" + "Street should be uppercase": "La dirección fiscal debe ir en mayúscula", + "The response is not a PDF": "La respuesta no es un PDF" } diff --git a/modules/route/back/methods/route/downloadCmrsZip.js b/modules/route/back/methods/route/downloadCmrsZip.js index 61f9701b5..532e019b6 100644 --- a/modules/route/back/methods/route/downloadCmrsZip.js +++ b/modules/route/back/methods/route/downloadCmrsZip.js @@ -55,14 +55,10 @@ module.exports = Self => { responseType: 'arraybuffer', }); - if (response.headers['content-type'] !== 'application/pdf') { - throw new UserError(`The response for cmr id ${id} is not a PDF.`); - } + if (response.headers['content-type'] !== 'application/pdf') + throw new UserError(`The response is not a PDF`); - const pdfData = response.data; - const fileName = `${id}.pdf`; - - zip.file(fileName, pdfData, { binary: true }); + zip.file(`${id}.pdf`, response.data, { binary: true }); } const zipStream = zip.generateNodeStream({ streamFiles: true });