Skip to content

The Open Source DocuSign Alternative.

fix: incorrect download filename logic

Lucas Smith927cb1a9344f
diff --git a/packages/lib/client-only/download-pdf.ts b/packages/lib/client-only/download-pdf.ts
index 0f757c98d..2e450de0c 100644
--- a/packages/lib/client-only/download-pdf.ts
+++ b/packages/lib/client-only/download-pdf.ts
@@ -15,12 +15,10 @@ export const downloadPDF = async ({ documentData, fileName }: DownloadPDFProps)
type: 'application/pdf',
});
- const [baseTitle] = fileName?.includes('.pdf')
- ? fileName.split('.pdf')
- : [fileName ?? 'document'];
+ const baseTitle = (fileName ?? 'document').replace(/\.pdf$/, '');
downloadFile({
- filename: baseTitle,
+ filename: `${baseTitle}.pdf`,
data: blob,
});
};