Skip to content

Commit

Permalink
make the split more forgiving in the "report" chat command
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
jeffschaller authored Apr 19, 2024
1 parent de1cbe8 commit 4634181
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion chatcommands.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down

0 comments on commit 4634181

Please sign in to comment.