🔥 The free & Open Source DocuSign alternative
JavaScript digital-signaturedocument-signingdocusign-alternativedocusign-freee-signatureelectronic-signatureelectronic-signaturesesignesignaturehacktoberfestjavascriptlegaltechmongodbnodejsopen-sourcepdf-signpdf-signaturereactjsself-hostedsign-pdf-files
#167 - Sanitize Output filename (#176)
Rishab6b8bca080284
diff --git a/Makefile b/Makefileindex bf7f219d3..d44c064b7 100644--- a/Makefile+++ b/Makefile@@ -2,7 +2,7 @@ build:cp .env.local_dev .envrm -rf apps/OpenSign/public/mfbuildcd microfrontends/SignDocuments && npm install && npm run build- docker compose up -d+ docker compose up --build --force-recreaterun:cp .env.local_dev .envdiff --git a/microfrontends/SignDocuments/src/Component/LegaDrive/FolderDrive/legaDriveComponent.js b/microfrontends/SignDocuments/src/Component/LegaDrive/FolderDrive/legaDriveComponent.jsindex ab7d1bd4c..df62c822d 100644--- a/microfrontends/SignDocuments/src/Component/LegaDrive/FolderDrive/legaDriveComponent.js+++ b/microfrontends/SignDocuments/src/Component/LegaDrive/FolderDrive/legaDriveComponent.js@@ -99,7 +99,7 @@ function PdfFileComponent({//function for navigate user to microapp-signature componentconst checkPdfStatus = async (data) => {-+const hostUrl = getHostUrl();const expireDate = data.ExpiryDate.iso;const expireUpdateDate = new Date(expireDate).getTime();@@ -221,13 +221,19 @@ function PdfFileComponent({// console.log("download")const pdfName = data && data.Name;const pdfUrl = data && data.SignedUrl ? data.SignedUrl : data.URL;- saveAs(pdfUrl, `${pdfName}_signed_by_OpenSign™.pdf`);+ saveAs(pdfUrl, `${sanitizeFileName(pdfName)}_signed_by_OpenSign™.pdf`);} else if (selectType === "Rename") {// console.log("rename")setRenameValue(data.Name);setRename(data.objectId);}};++ const sanitizeFileName = (pdfName) => {+ // Replace spaces with underscore+ return pdfName.replace(/ /g, '_');+ }+const handleEnterPress = (e, data) => {if (e.key === "Enter") {handledRenameDoc(data);diff --git a/microfrontends/SignDocuments/src/Component/component/emailComponent.js b/microfrontends/SignDocuments/src/Component/component/emailComponent.jsindex 5892c8ef5..532b3be4e 100644--- a/microfrontends/SignDocuments/src/Component/component/emailComponent.js+++ b/microfrontends/SignDocuments/src/Component/component/emailComponent.js@@ -28,9 +28,9 @@ function EmailComponent({setIsLoading(true);let sendMail;for (let i = 0; i < emailCount.length; i++) {-+try {-+const imgPng ="https://qikinnovation.ams3.digitaloceanspaces.com/logo.png";// "https://qikinnovation.ams3.digitaloceanspaces.com/mailLogo_2023-08-18T12%3A51%3A31.573Z.png";@@ -41,7 +41,7 @@ function EmailComponent({"X-Parse-Application-Id": localStorage.getItem("parseAppId"),sessionToken: localStorage.getItem("accesstoken")};-+const themeBGcolor = themeColor();let params = {pdfName: pdfName,@@ -125,12 +125,17 @@ function EmailComponent({//handle download signed pdfconst handleDownloadPdf = () => {- 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, '_');+ }+const isAndroid = /Android/i.test(navigator.userAgent);-+return (<div>{/* isEmail */}@@ -248,13 +253,13 @@ function EmailComponent({style={{display: "flex",flexDirection: "row",-+flexWrap: "wrap"}}>{emailCount.map((data, ind) => {return (- <div className="emailChip"+ <div className="emailChip"style={{display:"flex", flexDirection:"row", alignItems:"center"}}key={ind}><spandiff --git a/microfrontends/SignDocuments/src/Component/component/header.js b/microfrontends/SignDocuments/src/Component/component/header.jsindex 94f7fa68f..c68ad4ada 100644--- a/microfrontends/SignDocuments/src/Component/component/header.js+++ b/microfrontends/SignDocuments/src/Component/component/header.js@@ -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 (<divstyle={{ 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 currentuser exist than show finish button else no*/}{currentSigner && (