From 93671f0709a67516aa312a8dac581c66a663a7d6 Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Tue, 27 Feb 2024 18:03:58 +0300 Subject: Telegram: only match HTTP URLs to display --- src/main/java/com/juick/TelegramBotManager.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src/main/java/com') diff --git a/src/main/java/com/juick/TelegramBotManager.java b/src/main/java/com/juick/TelegramBotManager.java index 53ef2f47..130934c5 100644 --- a/src/main/java/com/juick/TelegramBotManager.java +++ b/src/main/java/com/juick/TelegramBotManager.java @@ -207,7 +207,12 @@ public class TelegramBotManager implements NotificationListener { Tap to [log into website](%s) to get more info""", user_from.getName(), msgUrl); telegramNotify(message.from().id(), msg, new com.juick.model.Message()); } else { - var messageNumber = WebUtils.getMessageNumberFromUrl(webDomain, UriComponentsBuilder.fromUriString(text.trim()).build()); + int messageNumber = 0; + try { + messageNumber = WebUtils.getMessageNumberFromUrl(webDomain, UriComponentsBuilder.fromHttpUrl(text.trim()).build()); + } catch (IllegalArgumentException ignored) { + + } if (messageNumber > 0) { var msg = messagesService.getMessage(messageNumber); if (msg.isPresent()) { -- cgit v1.2.3