Commit ed2280c477

ed2280c477c35fee57d7f58fc86b2e4fba02df3e

parent: 81870d8fa0

Unregistered key

vaw <git@nlih.de> · 2026-07-24 15:06 UTC
committer: <noreply@github.com>

Search plaintext body for links to open as fallback (#573)

Layout: unified · split

src/windows/room/chat.rs +8 −4
@@ -231,17 +231,21 @@ impl ChatState {
231231 return Err(IambError::NoAttachment.into());
232232 }
233233
234 let links = if let Some(html) = &msg.html {
234 let mut links = if let Some(html) = &msg.html {
235235 html.get_links()
236236 } else {
237 linkify::LinkFinder::new()
237 vec![]
238 };
239
240 if links.is_empty() {
241 links = linkify::LinkFinder::new()
238242 .links(&msg.event.body())
239243 .filter_map(|u| Url::parse(u.as_str()).ok())
240244 .scan(TreeGenState { link_num: 0 }, |state, u| {
241245 state.next_link_char().map(|c| (c, u))
242246 })
243 .collect()
244 };
247 .collect();
248 }
245249
246250 if links.is_empty() {
247251 return Err(IambError::NoAttachment.into());