From bc5d0d4ed09833640856ee0193a53553dbb1eb20 Mon Sep 17 00:00:00 2001
From: default
Date: Mon, 20 Nov 2023 18:33:24 +0100
Subject: Replaced encode_html_strict() with xs_html_encode().
---
format.c | 16 ++--------------
1 file changed, 2 insertions(+), 14 deletions(-)
(limited to 'format.c')
diff --git a/format.c b/format.c
index cfe2294..019260c 100644
--- a/format.c
+++ b/format.c
@@ -4,6 +4,7 @@
#include "xs.h"
#include "xs_regex.h"
#include "xs_mime.h"
+#include "xs_html.h"
#include "snac.h"
@@ -260,23 +261,10 @@ xs_str *sanitize(const char *content)
}
-xs_str *encode_html_strict(const char *str)
-/* escapes html characters */
-{
- xs_str *encoded = xs_replace(str, "&", "&");
- encoded = xs_replace_i(encoded, "<", "<");
- encoded = xs_replace_i(encoded, ">", ">");
- encoded = xs_replace_i(encoded, "\"", """);
- encoded = xs_replace_i(encoded, "'", "'");
-
- return encoded;
-}
-
-
xs_str *encode_html(const char *str)
/* escapes html characters */
{
- xs_str *encoded = encode_html_strict(str);
+ xs_str *encoded = xs_html_encode((char *)str);
/* Restore only
. Probably safe. Let's hope nothing goes wrong with this. */
encoded = xs_replace_i(encoded, "<br>", "
");
--
cgit v1.2.3