Commit ed2280c477
Unregistered key
Layout: unified · split
src/windows/room/chat.rs +8 −4
| @@ -231,17 +231,21 @@ impl ChatState { | ||
| 231 | 231 | return Err(IambError::NoAttachment.into()); |
| 232 | 232 | } |
| 233 | 233 | |
| 234 | let links = if let Some(html) = &msg.html { | |
| 234 | let mut links = if let Some(html) = &msg.html { | |
| 235 | 235 | html.get_links() |
| 236 | 236 | } else { |
| 237 | linkify::LinkFinder::new() | |
| 237 | vec![] | |
| 238 | }; | |
| 239 | ||
| 240 | if links.is_empty() { | |
| 241 | links = linkify::LinkFinder::new() | |
| 238 | 242 | .links(&msg.event.body()) |
| 239 | 243 | .filter_map(|u| Url::parse(u.as_str()).ok()) |
| 240 | 244 | .scan(TreeGenState { link_num: 0 }, |state, u| { |
| 241 | 245 | state.next_link_char().map(|c| (c, u)) |
| 242 | 246 | }) |
| 243 | .collect() | |
| 244 | }; | |
| 247 | .collect(); | |
| 248 | } | |
| 245 | 249 | |
| 246 | 250 | if links.is_empty() { |
| 247 | 251 | return Err(IambError::NoAttachment.into()); |