From 7d6264b46b4e130338a62fed9869c87b1263e176 Mon Sep 17 00:00:00 2001 From: RachelElysia <71795832+RachelElysia@users.noreply.github.com> Date: Fri, 1 Sep 2023 11:57:15 -0400 Subject: [PATCH] Fleet UI: More picky regex (Add alternative where must have http and/or www in link) (#13639) --- frontend/components/ClickableUrls/ClickableUrls.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/components/ClickableUrls/ClickableUrls.tsx b/frontend/components/ClickableUrls/ClickableUrls.tsx index 6a381c1cb9..444dee0f3d 100644 --- a/frontend/components/ClickableUrls/ClickableUrls.tsx +++ b/frontend/components/ClickableUrls/ClickableUrls.tsx @@ -21,7 +21,7 @@ const ClickableUrls = ({ text, className }: IClickableUrls): JSX.Element => { // Regex to find case insensitive URLs and replace with link const replacedLinks = text.replaceAll( - /(https?)?(:\/\/)?(www\.)?[-a-zA-Z0-9@:%._+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_+.~#?&//=]*)/g, + /(((https?)?(:\/\/))|((https?)?(:\/\/)?(www\.)))[-a-zA-Z0-9@:%._+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_+.~#?&//=]*)/g, urlReplacer ); const sanitizedResolutionContent = DOMPurify.sanitize(replacedLinks, {