fix: more strict regex

This commit is contained in:
Chayapak Supasakul 2025-04-10 17:16:21 +07:00
parent a085756c7d
commit 79589edc44
Signed by: ChomeNS
SSH key fingerprint: SHA256:0YoxhdyXsgbc0nfeB2N6FYE60mxMU7DS4uCUMaw2mvA

View file

@ -21,6 +21,7 @@ import java.nio.charset.StandardCharsets;
import java.util.Map;
import java.util.Timer;
import java.util.TimerTask;
import java.util.regex.Pattern;
public class CustomChat {
private static final GsonComponentSerializer GSON = GsonComponentSerializer.gson();
@ -34,6 +35,9 @@ public class CustomChat {
.toBuilder()
.extractUrls(
Pattern
.compile("((https?://(ww(w|\\d)\\.)?|ww(w|\\d))[-a-zA-Z0-9@:%._+~#=]{1,256}"
+ "\\.[a-zA-Z0-9]{1,63}\\b([-a-zA-Z0-9@:%_+.~#?&/=]*))"),
Style.style(
NamedTextColor.BLUE,
TextDecoration.UNDERLINED,