From 99a45590a48bf5d78696a53f8402f02e246c99de Mon Sep 17 00:00:00 2001 From: CoconutMacaroon <45187468+CoconutMacaroon@users.noreply.github.com> Date: Sun, 18 Aug 2024 06:06:14 +0000 Subject: [PATCH] Reject multiline chat messages attempting to watch/blacklist keywords --- chatcommands.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/chatcommands.py b/chatcommands.py index 39fff25b2c..b18025c2dc 100644 --- a/chatcommands.py +++ b/chatcommands.py @@ -389,6 +389,13 @@ def get_normalized_on_list(list_type, extra=''): text_before_pattern = '' text_after_pattern = '' + # Block multiline chat messages to avoid corrupting the watchlist/blacklist file(s) + # Using -force should not bypass this, as that still results in file corruption + if '\n' in pattern: + raise CmdException("The watchlist/blacklist cannot be modified using multiline chat messages. If" + " your desired change exceeds the length of a standard chat message, consider" + " using Git to make the change (or ping someone who can).") + other_issues = [] if '\u202d' in pattern: other_issues.append("The pattern contains an invisible U+202D whitespace character.")