#167 - Sanitize Output filename (#176)

This commit is contained in:
Rishab
2023-11-11 13:25:04 +05:30
committed by GitHub
parent fed1cff0cb
commit 6b8bca0802
4 changed files with 29 additions and 12 deletions
@@ -76,9 +76,15 @@ function Header({
const handleDownloadPdf = () => {
const pdfName = pdfDetails[0] && pdfDetails[0].Name;
saveAs(pdfUrl, `${pdfName}_signed_by_OpenSign™.pdf`);
saveAs(pdfUrl, `${sanitizeFileName(pdfName)}_signed_by_OpenSign™.pdf`);
};
const sanitizeFileName = (pdfName) => {
// Replace spaces with underscore
return pdfName.replace(/ /g, '_');
}
return (
<div
style={{ padding: !isGuestSigner && "5px 0px 5px 0px" }}
@@ -217,7 +223,7 @@ function Header({
</DropdownMenu.Root>
) : (
<div style={{ display: "flex", justifyContent: "space-around" }}>
{/* current signer is checking user send request and check status of pdf sign than if current
{/* current signer is checking user send request and check status of pdf sign than if current
user exist than show finish button else no
*/}
{currentSigner && (