From 60a46626d946b3f59ef5829e3665d7a6c7b8654e Mon Sep 17 00:00:00 2001 From: Armored Dragon Date: Sat, 25 May 2024 05:43:53 -0500 Subject: [PATCH] Updated URL regex. Seems to preform better at picking out what is and what is not a URL. Signed-off-by: Armored Dragon --- scripts/communityScripts/armored-chat/armored_chat.qml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/communityScripts/armored-chat/armored_chat.qml b/scripts/communityScripts/armored-chat/armored_chat.qml index 3bfb7aa95d..f7f5e3b642 100644 --- a/scripts/communityScripts/armored-chat/armored_chat.qml +++ b/scripts/communityScripts/armored-chat/armored_chat.qml @@ -498,7 +498,7 @@ Rectangle { } function formatContent(mess) { - var link = /(https?:\/\/)?[\w.-]+(?:\.[\w\.-]+)+(?:\/[\w\-\._~:/?#[\]@!\$&'\(\)\*\+,;=.]*)?(?=\s|$)/g; + var link = /https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_\+.~#?&//=]*)/g; mess = mess.replace(link, (match) => {return "" + match + " "}); var script_tag = /]*>/gi; @@ -510,7 +510,7 @@ Rectangle { } function embedImages(mess){ - var image_link = /(https?:\/\/)?[\w.-]+(?:\.[\w\.-]+)+(?:\/[\w\-\._~:/?#[\]@!\$&'\(\)\*\+,;=.]*)(?:png|jpe?g|gif|bmp|svg|webp)/g; + var image_link = /(https?:(\/){2})[\w.-]+(?:\.[\w\.-]+)+(?:\/[\w\-\._~:/?#[\]@!\$&'\(\)\*\+,;=.]*)(?:png|jpe?g|gif|bmp|svg|webp)/g; var matches = mess.match(image_link); var new_message = "" var listed = []