From c461fbc268b8db52de64f4a542d385b446ccbd2a Mon Sep 17 00:00:00 2001 From: silverpill Date: Sun, 12 Feb 2023 21:38:22 +0000 Subject: [PATCH] Re-export ammonia::clean_text from utils::html --- src/atom/feeds.rs | 6 ++---- src/utils/html.rs | 2 ++ 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/atom/feeds.rs b/src/atom/feeds.rs index d083cbb..65d00b2 100644 --- a/src/atom/feeds.rs +++ b/src/atom/feeds.rs @@ -1,12 +1,10 @@ -use ammonia::clean_text; - use crate::activitypub::identifiers::{local_actor_id, local_object_id}; use crate::config::Instance; use crate::models::posts::types::Post; use crate::models::profiles::types::DbActorProfile; use crate::utils::{ datetime::get_min_datetime, - html::clean_html_all, + html::{clean_html_all, escape_html}, }; const ENTRY_TITLE_MAX_LENGTH: usize = 75; @@ -16,7 +14,7 @@ fn make_entry( post: &Post, ) -> String { let object_id = local_object_id(instance_url, &post.id); - let content_escaped = clean_text(&post.content); + let content_escaped = escape_html(&post.content); let content_cleaned = clean_html_all(&post.content); // Use trimmed content for title let mut title: String = content_cleaned.chars() diff --git a/src/utils/html.rs b/src/utils/html.rs index 8ccffd8..c7a0b4e 100644 --- a/src/utils/html.rs +++ b/src/utils/html.rs @@ -3,6 +3,8 @@ use std::iter::FromIterator; use ammonia::Builder; +pub use ammonia::{clean_text as escape_html}; + pub fn clean_html( unsafe_html: &str, allowed_classes: Vec<(&'static str, Vec<&'static str>)>,