projects
/
lemmy.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
9a5a13c
)
Restore markdown quotes after sanitize (#3708) (#3749)
author
Nutomic
<me@nutomic.com>
Fri, 28 Jul 2023 12:23:46 +0000
(14:23 +0200)
committer
GitHub
<noreply@github.com>
Fri, 28 Jul 2023 12:23:46 +0000
(08:23 -0400)
crates/api_common/src/utils.rs
patch
|
blob
|
history
diff --git
a/crates/api_common/src/utils.rs
b/crates/api_common/src/utils.rs
index 8ccb7d3fed5dc482d00b73af1a8283dad9ad47dd..5a678191bb2cfdf7bab72c98f81f38b698627292 100644
(file)
--- a/
crates/api_common/src/utils.rs
+++ b/
crates/api_common/src/utils.rs
@@
-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> {