mirror of
https://github.com/OpenSignLabs/OpenSign.git
synced 2026-08-17 21:25:54 +02:00
#204 - Fix issue due to Signature URL validation
This commit is contained in:
+9
@@ -36,6 +36,7 @@
|
||||
"react-scrollbars-custom": "^4.1.1",
|
||||
"react-signature-canvas": "^1.0.6",
|
||||
"reactour": "^1.19.1",
|
||||
"validator": "^13.11.0",
|
||||
"web-vitals": "^2.1.4"
|
||||
}
|
||||
},
|
||||
@@ -20502,6 +20503,14 @@
|
||||
"resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-1.9.0.tgz",
|
||||
"integrity": "sha512-ASFBup0Mz1uyiIjANan1jzLQami9z1PoYSZCiiYW2FczPbenXc45FZdBZLzOT+r6+iciuEModtmCti+hjaAk0A=="
|
||||
},
|
||||
"node_modules/validator": {
|
||||
"version": "13.11.0",
|
||||
"resolved": "https://registry.npmjs.org/validator/-/validator-13.11.0.tgz",
|
||||
"integrity": "sha512-Ii+sehpSfZy+At5nPdnyMhx78fEoPDkR2XW/zimHEL3MyGJQOCQ7WeP20jPYRz7ZCpcKLB21NxuXHF3bxjStBQ==",
|
||||
"engines": {
|
||||
"node": ">= 0.10"
|
||||
}
|
||||
},
|
||||
"node_modules/vary": {
|
||||
"version": "1.1.2",
|
||||
"resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz",
|
||||
|
||||
@@ -32,6 +32,7 @@
|
||||
"react-scrollbars-custom": "^4.1.1",
|
||||
"react-signature-canvas": "^1.0.6",
|
||||
"reactour": "^1.19.1",
|
||||
"validator": "^13.11.0",
|
||||
"web-vitals": "^2.1.4"
|
||||
},
|
||||
"scripts": {
|
||||
|
||||
@@ -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);
|
||||
};
|
||||
Reference in New Issue
Block a user