fixing url pattern on mobile

This commit is contained in:
balzack 2025-03-26 23:15:06 -07:00
parent 38a637e5cb
commit d0e69246cc

View File

@ -61,6 +61,7 @@ export function Message({
useEffect(() => {
const urlPattern = new RegExp('(https?:\\/\\/)?(www\\.)?[-a-zA-Z0-9@:%._\\+~#=]{2,256}\\.[a-z]{2,4}\\b([-a-zA-Z0-9@:%_\\+.~#?&//=]*)');
const hostPattern = new RegExp('^https?:\\/\\/', 'i');
const dotPattern = new RegExp('^.*\\.\\..*$')
let plain = '';
let clickable = [];
@ -69,7 +70,7 @@ export function Message({
if (parsed?.length > 0) {
const words = parsed as string[];
words.forEach((word, index) => {
if (urlPattern.test(word)) {
if (urlPattern.test(word) && !dotPattern.test(word)) {
clickable.push(
<Text key={index} style={textStyle}>
{plain}