commit 61646fd
grunfink
·
2026-09-23 09:46:47 +0000 UTC
parent b948a87
Fixed crash when sending an empty EmojiReact.
1 files changed,
+10,
-7
M
html.c
M
html.c
+10,
-7
1@@ -572,6 +572,7 @@ xs_html *html_emoji(snac *user, const char *summary,
2 xs_html_sctag("input",
3 xs_html_attr("type", react ? "hidden" : "text"),
4 xs_html_attr("name", "eid"),
5+ xs_html_attr("required", "required"),
6 xs_html_attr(react ? "value" : "placeholder", react ? eid : placeholder)),
7 xs_html_text(" "),
8 xs_html_sctag("input",
9@@ -5842,14 +5843,16 @@ int html_post_handler(const xs_dict *req, const char *q_path,
10 if (strcmp(action, L("EmojiReact")) == 0) { /** **/
11 xs *eid = xs_dup(xs_dict_get(p_vars, "eid"));
12
13- xs *ret = msg_emoji_init(&snac, id, eid);
14- /* fails if either invalid or already reacted */
15- if (!ret) {
16- object_user_cache_del(&snac, id, "admire");
17- ret = msg_emoji_unreact(&snac, id, eid);
18+ if (xs_is_string(eid) && strcmp(eid, "%")) {
19+ xs *ret = msg_emoji_init(&snac, id, eid);
20+ /* fails if either invalid or already reacted */
21+ if (!ret) {
22+ object_user_cache_del(&snac, id, "admire");
23+ ret = msg_emoji_unreact(&snac, id, eid);
24+ }
25+ if (!ret)
26+ status = HTTP_STATUS_NOT_FOUND;
27 }
28- if (!ret)
29- status = HTTP_STATUS_NOT_FOUND;
30 }
31 else
32 if (strcmp(action, L("Like")) == 0) { /** **/