mirror of
https://codeberg.org/grunfink/snac2.git
synced 2024-11-25 06:25:04 +00:00
Archive and try to avoid crashing on unexpected 'content' field data type.
This commit is contained in:
parent
e6483368d0
commit
60e907219b
1 changed files with 8 additions and 1 deletions
9
html.c
9
html.c
|
@ -1692,7 +1692,14 @@ xs_html *html_entry(snac *user, xs_dict *msg, int read_only,
|
||||||
/** build the content string **/
|
/** build the content string **/
|
||||||
const char *content = xs_dict_get(msg, "content");
|
const char *content = xs_dict_get(msg, "content");
|
||||||
|
|
||||||
xs *c = sanitize(xs_is_null(content) ? "" : content);
|
if (xs_type(content) != XSTYPE_STRING) {
|
||||||
|
srv_archive_error("unexpected_content_xstype",
|
||||||
|
"content field type", xs_stock(XSTYPE_DICT), msg);
|
||||||
|
|
||||||
|
content = "";
|
||||||
|
}
|
||||||
|
|
||||||
|
xs *c = sanitize(content);
|
||||||
|
|
||||||
/* do some tweaks to the content */
|
/* do some tweaks to the content */
|
||||||
c = xs_replace_i(c, "\r", "");
|
c = xs_replace_i(c, "\r", "");
|
||||||
|
|
Loading…
Reference in a new issue