From 5a31d78a0761c7d07faadb78431a68a1bb6944e4 Mon Sep 17 00:00:00 2001 From: OFF0 Date: Wed, 9 Aug 2023 12:03:36 +0200 Subject: [PATCH] content: fix parse links with uppercase characters ignore case sensitivity when checking for possible links --- src/utils/dom.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/utils/dom.ts b/src/utils/dom.ts index fcfd1b4..b408618 100644 --- a/src/utils/dom.ts +++ b/src/utils/dom.ts @@ -104,11 +104,12 @@ export const parseTextContent = ( return elem('a', {href: `/${npub}`, data: {profile: data}}, data.slice(6, 15)) } } - if (!word.match(/^(https?:\/\/|www\.)\S*/)) { + const WORD = word.toUpperCase(); + if (!WORD.match(/^(HTTPS?:\/\/|WWW\.)\S*/)) { return word; } try { - if (!word.startsWith('http')) { + if (!WORD.startsWith('HTTP')) { word = 'https://' + word; } const url = new URL(word);