content: fix parse links with uppercase characters

ignore case sensitivity when checking for possible links
pull/84/head
OFF0 9 months ago
parent a73af8bb78
commit 5a31d78a07
Signed by: offbyn
GPG Key ID: 94A2F643C51F37FA

@ -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);

Loading…
Cancel
Save