diff options
author | Vitaly Takmazov | 2024-02-27 18:03:58 +0300 |
---|---|---|
committer | Vitaly Takmazov | 2024-02-28 20:15:49 +0300 |
commit | 93671f0709a67516aa312a8dac581c66a663a7d6 (patch) | |
tree | 5d55a4f2d8d5820cc3960693f8a88ae59a336267 | |
parent | d362ccd2f45f0fba2220e378aad6f2310aff22fa (diff) |
Telegram: only match HTTP URLs to display
-rw-r--r-- | src/main/java/com/juick/TelegramBotManager.java | 7 |
1 files changed, 6 insertions, 1 deletions
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()) { |