Fix removing html tags for inline preview

This commit is contained in:
Laura Hausmann 2023-03-12 19:21:28 +01:00
parent f776d21261
commit 040ea520bd
Signed by: zotan
GPG Key ID: D044E84C5BE01605
1 changed files with 1 additions and 1 deletions

View File

@ -17,7 +17,7 @@
var desc = Model.Post.Content;
desc = Regex.Replace(desc, @"\s+", " "); // collapse whitespace
desc = Regex.Replace(desc, @"(?i)<\/?[aibu][^>]*>", ""); // remove <a>, <i>, <b> and <u> html tags
desc = Regex.Replace(desc, @"(?i)<\/?(?:[aibu]|em)[^>]*>", ""); // remove <a>, <i>, <b>, <u> and <em> html tags
desc = desc.Trim(); // remove leading and trailing whitespace
desc = Regex.Match(desc, @"<p>([^<].*?)<\/p>").Groups[1].ToString().GetUntil("."); // get first sentence
ViewData["og-desc"] = desc;