Skip to content

Commit

Permalink
fix: incorrect download filename logic
Browse files Browse the repository at this point in the history
  • Loading branch information
Mythie committed Mar 5, 2024
1 parent 579a2f9 commit 927cb1a
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions packages/lib/client-only/download-pdf.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
});
};

0 comments on commit 927cb1a

Please sign in to comment.