From ae6c1ba5a9ced4111127b8a459f8dc8705dc8e4b Mon Sep 17 00:00:00 2001 From: n9k Date: Sat, 28 May 2022 05:40:53 +0000 Subject: [PATCH] Reject whitespace-only comments --- anonstream/chat.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/anonstream/chat.py b/anonstream/chat.py index ea875f6..473d9b5 100644 --- a/anonstream/chat.py +++ b/anonstream/chat.py @@ -59,6 +59,8 @@ def add_chat_message(user, nonce, comment, ignore_empty=False): raise Rejected('Discarded suspected duplicate message') if len(comment) == 0: raise Rejected('Message was empty') + if len(comment.strip()) == 0: + raise Rejected('Message was practically empty') if len(comment) > 512: raise Rejected('Message exceeded 512 chars') if comment.count('\n') + 1 > 12: