From: Kradyz <81911574+Kradyz@users.noreply.github.com> Date: Tue, 7 Feb 2023 02:27:17 +0000 (+0100) Subject: Convert HTML from titles into markdown (#2709) X-Git-Url: http://these/git/%22https:/join-lemmy.org/static/readmes/%7Blink%7D?a=commitdiff_plain;h=ab9b60e86d5e0ef42cd3c026258fb0f94d1856d8;p=lemmy.git Convert HTML from titles into markdown (#2709) Co-authored-by: Kradyz --- diff --git a/crates/apub/src/objects/post.rs b/crates/apub/src/objects/post.rs index 33794344..e7a1d475 100644 --- a/crates/apub/src/objects/post.rs +++ b/crates/apub/src/objects/post.rs @@ -23,6 +23,7 @@ use activitypub_federation::{ use activitystreams_kinds::public; use anyhow::anyhow; use chrono::NaiveDateTime; +use html2md::parse_html; use lemmy_api_common::{ context::LemmyContext, request::fetch_site_data, @@ -183,7 +184,8 @@ impl ApubObject for ApubPost { page .content .clone() - .and_then(|c| c.lines().next().map(ToString::to_string)) + .as_ref() + .and_then(|c| parse_html(c).lines().next().map(ToString::to_string)) }) .ok_or_else(|| anyhow!("Object must have name or content"))?; if name.chars().count() > MAX_TITLE_LENGTH {