From 74ddac9d8d19e0b953b8bf0591279396d3efa322 Mon Sep 17 00:00:00 2001 From: vaw Date: Mon, 16 Feb 2026 22:38:41 +0100 Subject: [PATCH] Search plaintext body for links to open as fallback --- src/windows/room/chat.rs | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/windows/room/chat.rs b/src/windows/room/chat.rs index 3a518aa0..a3252f5a 100644 --- a/src/windows/room/chat.rs +++ b/src/windows/room/chat.rs @@ -231,17 +231,21 @@ impl ChatState { return Err(IambError::NoAttachment.into()); } - let links = if let Some(html) = &msg.html { + let mut links = if let Some(html) = &msg.html { html.get_links() } else { - linkify::LinkFinder::new() + vec![] + }; + + if links.is_empty() { + links = linkify::LinkFinder::new() .links(&msg.event.body()) .filter_map(|u| Url::parse(u.as_str()).ok()) .scan(TreeGenState { link_num: 0 }, |state, u| { state.next_link_char().map(|c| (c, u)) }) - .collect() - }; + .collect(); + } if links.is_empty() { return Err(IambError::NoAttachment.into());