Browse Source

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.
fix-filtering
Maximiliano Sandoval R 5 years ago
parent
commit
8bf85c11d7
No known key found for this signature in database
GPG Key ID: DAF997B4C5A9DF5A
  1. 6
      fractal-gtk/src/widgets/message.rs

6
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<gtk::Box> {
let raw = msg.msg.formatted_body.clone().unwrap_or_default();
if raw.contains("<!-- raw HTML omitted -->") {
anyhow::bail!(
"Empty message omited: <!-- raw HTML omitted -->, 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);

Loading…
Cancel
Save