web: sanitize content

This commit is contained in:
Thomas Mathews 2022-12-20 09:21:06 -08:00
parent 643add9177
commit 7954c75841
2 changed files with 5 additions and 5 deletions

View file

@ -29,9 +29,9 @@ function format_content(ev, show_media) {
if (ev.kind === 7) {
if (ev.content === "" || ev.content === "+")
return "❤️"
return sanitize(ev.content.trim())
return sanitize(ev.content.trim());
}
const content = ev.content.trim()
const content = sanitize(ev.content.trim());
const body = convert_quote_blocks(content, show_media)
let cw = get_content_warning(ev.tags)
if (cw !== null) {

View file

@ -188,10 +188,10 @@ function fmt_since_str(current, previous) {
}
}
function sanitize(content) {
if (!content)
function sanitize(str) {
if (!str)
return ""
return content.replaceAll("<","&lt;").replaceAll(">","&gt;")
return str.replaceAll("<","&lt;").replaceAll(">","&gt;")
}
function robohash(str) {