From 8bf85c11d7483d339b4e8b2325f1db64159e8190 Mon Sep 17 00:00:00 2001 From: Maximiliano Sandoval R Date: Tue, 22 Dec 2020 15:11:44 +0100 Subject: [PATCH] Message Widget: Do not render incomplete messages If a message contains raw html, the formatted body will contain a comment, and instead of showing an incomplete message, the plain text message is used. --- fractal-gtk/src/widgets/message.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/fractal-gtk/src/widgets/message.rs b/fractal-gtk/src/widgets/message.rs index 218906d0..319d7a24 100644 --- a/fractal-gtk/src/widgets/message.rs +++ b/fractal-gtk/src/widgets/message.rs @@ -523,6 +523,12 @@ fn build_room_msg( fn build_room_msg_body_html(container: &MessageBoxContainer, msg: &Message) -> anyhow::Result { let raw = msg.msg.formatted_body.clone().unwrap_or_default(); + if raw.contains("") { + anyhow::bail!( + "Empty message omited: , using plain text instead." + ); + } + let blocks = markup_html(&raw).with_context(|| format!("Could not render message: {}", &raw))?; let bx = gtk::Box::new(gtk::Orientation::Vertical, 6);