From 83d294585e4859ba91eea1f395cd56adf894a946 Mon Sep 17 00:00:00 2001 From: Nicoleta Panaghiu Date: Thu, 15 Feb 2024 14:31:43 +0200 Subject: [PATCH] RED-7273: fixed viewer not opening docx files. --- .../src/app/modules/pdf-viewer/services/pdf-viewer.service.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/apps/red-ui/src/app/modules/pdf-viewer/services/pdf-viewer.service.ts b/apps/red-ui/src/app/modules/pdf-viewer/services/pdf-viewer.service.ts index 83cab4409..92ae1ba39 100644 --- a/apps/red-ui/src/app/modules/pdf-viewer/services/pdf-viewer.service.ts +++ b/apps/red-ui/src/app/modules/pdf-viewer/services/pdf-viewer.service.ts @@ -201,13 +201,14 @@ export class PdfViewer { this.fileId = file.fileId; this.dossierId = file.dossierId; + const filename = file?.filename.includes('.pdf') ? file?.filename : `${file?.filename}.pdf`; this._logger.info('[PDF] Loading document...'); await this.runWithCleanup(async () => { const document = await this.documentViewer.getDocument()?.getPDFDoc(); await document?.lock(); - this.#instance.UI.loadDocument(blob, { documentId: file.fileId, filename: file?.filename ?? 'document.pdf', onError }); + this.#instance.UI.loadDocument(blob, { documentId: file.fileId, filename: filename ?? 'document.pdf', onError }); }); }