From 6463a9f09032f22c8e39ccea757b8a7054f199ba Mon Sep 17 00:00:00 2001 From: Jakob L. Kreuze Date: Sat, 11 Mar 2023 19:33:53 -0500 Subject: Guard against non-emoji reactions --- haunt/jakob/dynamic/capabilities/comments.scm | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'haunt/jakob/dynamic/capabilities') diff --git a/haunt/jakob/dynamic/capabilities/comments.scm b/haunt/jakob/dynamic/capabilities/comments.scm index 1da8abb..996c549 100644 --- a/haunt/jakob/dynamic/capabilities/comments.scm +++ b/haunt/jakob/dynamic/capabilities/comments.scm @@ -194,7 +194,8 @@ This is a wrapper around `get-comments-by-slug'." (let* ((id (assoc-value form-data "id")) (reaction (assoc-value form-data "reaction")) (reactions (comment-reactions id))) - (unless reactions (panic "no such comment")) + (unless id (panic "no such comment")) + (unless (emoji? reaction) (panic "invalid reaction")) (set-reactions id (add-reaction reactions reaction)) (values '((content-type . (application/json))) (scm->json-string `((success . #t))))))) -- cgit v1.3