#204 - Fix issue due to Signature URL validation

This commit is contained in:
Rishab
2023-11-22 06:20:02 +00:00
parent 2b73087b7e
commit 87c65e4bea
6 changed files with 27 additions and 9 deletions
@@ -14,7 +14,8 @@ import RenderAllPdfPage from "./component/renderAllPdfPage";
import {
contractDocument,
getBase64FromIMG,
getBase64FromUrl
getBase64FromUrl,
urlValidator
} from "../utils/Utils";
import Loader from "./component/loader";
import HandleError from "./component/HandleError";
@@ -346,7 +347,7 @@ function PdfRequestFiles() {
imgUrlList.map(async (data) => {
//cheking signUrl is defau;t signature url of custom url
let ImgUrl = data.SignUrl;
const checkUrl = ImgUrl.includes("https:");
const checkUrl = urlValidator(ImgUrl);
//if default signature url then convert it in base 64
if (checkUrl) {
@@ -434,7 +435,7 @@ function PdfRequestFiles() {
imgUrlList.map(async (url) => {
let signUrl = url.SignUrl;
const checkUrl = url.SignUrl.includes("https:");
const checkUrl = urlValidator(signUrl);
if (checkUrl) {
signUrl = signUrl + "?get";
}
@@ -24,7 +24,7 @@ import HandleError from "./component/HandleError";
import Nodata from "./component/Nodata";
import Header from "./component/header";
import RenderPdf from "./component/renderPdf";
import { contractUsers, contactBook } from "../utils/Utils";
import { contractUsers, contactBook, urlValidator } from "../utils/Utils";
//For signYourself inProgress section signer can add sign and complete doc sign.
function SignYourSelf() {
const [pdfDetails, setPdfDetails] = useState([]);
@@ -444,7 +444,7 @@ function SignYourSelf() {
imgUrlList.map(async (data) => {
let ImgUrl = data.SignUrl;
//cheking signUrl is defau;t signature url of custom url
const checkUrl = ImgUrl.includes("https:");
const checkUrl = urlValidator(ImgUrl);
//if default signature url then convert it in base 64
if (checkUrl) {
@@ -524,7 +524,7 @@ function SignYourSelf() {
imgUrlList.map(async (url) => {
let signUrl = url.SignUrl;
const checkUrl = url.SignUrl.includes("https:");
const checkUrl = urlValidator(signUrl);
if (checkUrl) {
signUrl = signUrl + "?get";
}
@@ -16,7 +16,8 @@ import {
getBase64FromIMG,
contractUsers,
contactBook,
contractDocument
contractDocument,
urlValidator
} from "../utils/Utils";
import Tour from "reactour";
import Signedby from "./component/signedby";
@@ -445,7 +446,7 @@ function EmbedPdfImage() {
imgUrlList.map(async (data) => {
//cheking signUrl is defau;t signature url of custom url
let ImgUrl = data.SignUrl;
const checkUrl = ImgUrl.includes("https:");
const checkUrl = urlValidator(ImgUrl);
//if default signature url then convert it in base 64
if (checkUrl) {
@@ -523,7 +524,7 @@ function EmbedPdfImage() {
const images = await Promise.all(
imgUrlList.map(async (url) => {
let signUrl = url.SignUrl;
const checkUrl = url.SignUrl.includes("https:");
const checkUrl = urlValidator(signUrl);
if (checkUrl) {
signUrl = signUrl + "?get";
}
@@ -1,4 +1,5 @@
import axios from "axios";
import validator from 'validator';
export async function getBase64FromUrl(url) {
const data = await fetch(url);
@@ -299,3 +300,8 @@ export const contactBook = async (objectId) => {
});
return result;
};
// function for validating URLs
export function urlValidator(url) {
return validator.isURL(url);
};