From 4634181f3dfeba48c2adaf3402e9064e44563983 Mon Sep 17 00:00:00 2001 From: Jeff Schaller <17769792+jeffschaller@users.noreply.github.com> Date: Thu, 18 Apr 2024 20:51:51 -0400 Subject: [PATCH] make the split more forgiving in the "report" chat command In situations where multiple spaces exist after the URL(s) and before the custom reason, the first element of "argsraw" might have trailing space(s). This change uses string.split()'s behavior with sep=None to regard runs of consecutive whitespace as a single separator (https://docs.python.org/3.3/library/stdtypes.html#str.split). This change also allows for multiple spaces between multiple URLs. --- chatcommands.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/chatcommands.py b/chatcommands.py index 6c4d6e7762..19545224ed 100644 --- a/chatcommands.py +++ b/chatcommands.py @@ -2078,7 +2078,7 @@ def report(msg, args, alias_used="report"): alias_used = alias_used or "report" argsraw = args.split(' "', 1) - urls = argsraw[0].split(' ') + urls = argsraw[0].split(sep=None) message_url = "https://chat.{0}/transcript/{1}?m={2}".format(msg._client.host, msg.room.id, msg.id)