aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2024-02-27 18:03:58 +0300
committerGravatar Vitaly Takmazov2024-02-28 20:15:49 +0300
commit93671f0709a67516aa312a8dac581c66a663a7d6 (patch)
tree5d55a4f2d8d5820cc3960693f8a88ae59a336267 /src
parentd362ccd2f45f0fba2220e378aad6f2310aff22fa (diff)
Telegram: only match HTTP URLs to display
Diffstat (limited to 'src')
-rw-r--r--src/main/java/com/juick/TelegramBotManager.java7
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()) {