Fleet UI: More picky regex (Add alternative where must have http and/or www in link) (#13639)

This commit is contained in:
RachelElysia
2023-09-01 11:57:15 -04:00
committed by GitHub
parent 6173af2b30
commit 7d6264b46b
@@ -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, {