From e94ebb5955101498cf7a5196e7391d2abd96fca3 Mon Sep 17 00:00:00 2001 From: jrmartin Date: Mon, 29 Jan 2024 10:06:49 +0100 Subject: [PATCH] #sdsv-9 Ensure all urls on Metadata panel are displayed as link --- src/components/NodeDetailView/Details/utils.js | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/src/components/NodeDetailView/Details/utils.js b/src/components/NodeDetailView/Details/utils.js index d9219b8..2939404 100644 --- a/src/components/NodeDetailView/Details/utils.js +++ b/src/components/NodeDetailView/Details/utils.js @@ -20,11 +20,5 @@ export const simpleValue = (label, value) => { } export const isValidUrl = (urlString) => { - var urlPattern = new RegExp('^(https?:\\/\\/)?' + // validate protocol - '((([a-z\\d]([a-z\\d-]*[a-z\\d])*)\\.)+[a-z]{2,}|' + // validate domain name - '((\\d{1,3}\\.){3}\\d{1,3}))' + // validate OR ip (v4) address - '(\\:\\d+)?(\\/[-a-z\\d%_.~+]*)*' + // validate port and path - '(\\?[;&a-z\\d%_.~+=-]*)?' + // validate query string - '(\\#[-a-z\\d_]*)?$', 'i'); // validate fragment locator - return !!urlPattern.test(urlString); + return /(https:\/\/www\.|http:\/\/www\.|https:\/\/|http:\/\/)?[a-zA-Z]{2,}(\.[a-zA-Z]{2,})(\.[a-zA-Z]{2,})?\/[a-zA-Z0-9]{2,}|((https:\/\/www\.|http:\/\/www\.|https:\/\/|http:\/\/)?[a-zA-Z]{2,}(\.[a-zA-Z]{2,})(\.[a-zA-Z]{2,})?)|(https:\/\/www\.|http:\/\/www\.|https:\/\/|http:\/\/)?[a-zA-Z0-9]{2,}\.[a-zA-Z0-9]{2,}\.[a-zA-Z0-9]{2,}(\.[a-zA-Z0-9]{2,})?/g.test(urlString); } \ No newline at end of file