mirror of
https://github.com/LemmyNet/lemmy.git
synced 2024-10-01 01:36:12 -04:00
parent
9a5a13c734
commit
0e6fb08284
@ -798,10 +798,12 @@ pub fn generate_moderators_url(community_id: &DbUrl) -> Result<DbUrl, LemmyError
|
||||
/// Sanitize HTML with default options. Additionally, dont allow bypassing markdown
|
||||
/// links and images
|
||||
pub fn sanitize_html(data: &str) -> String {
|
||||
ammonia::Builder::default()
|
||||
let sanitized = ammonia::Builder::default()
|
||||
.rm_tags(&["a", "img"])
|
||||
.clean(data)
|
||||
.to_string()
|
||||
.to_string();
|
||||
// restore markdown quotes
|
||||
sanitized.replace(">", ">")
|
||||
}
|
||||
|
||||
pub fn sanitize_html_opt(data: &Option<String>) -> Option<String> {
|
||||
|
Loading…
Reference in New Issue
Block a user