File tree Expand file tree Collapse file tree 2 files changed +11
-5
lines changed
Expand file tree Collapse file tree 2 files changed +11
-5
lines changed Original file line number Diff line number Diff line change @@ -62,9 +62,6 @@ async def actions_for(
6262 """Dispatch the given event to the list's filters, and return actions to take and messages to relay to mods."""
6363 text = clean_input (ctx .content )
6464
65- # Avoid escape characters
66- text = text .replace ("\\ " , "" )
67-
6865 matches = list (DISCORD_INVITE .finditer (text ))
6966 invite_codes = {m .group ("invite" ) for m in matches }
7067 if not invite_codes :
Original file line number Diff line number Diff line change 55import inspect
66import pkgutil
77import types
8+ import urllib .parse
89import warnings
910from abc import ABC , abstractmethod
1011from collections import defaultdict
@@ -55,8 +56,16 @@ def clean_input(string: str) -> str:
5556 # For future consideration: remove characters in the Mc, Sk, and Lm categories too.
5657 # Can be normalised with form C to merge char + combining char into a single char to avoid
5758 # removing legit diacritics, but this would open up a way to bypass _filters.
58- no_zalgo = ZALGO_RE .sub ("" , string )
59- return INVISIBLE_RE .sub ("" , no_zalgo )
59+ content = ZALGO_RE .sub ("" , string )
60+
61+ # URL quoted strings can be used to hide links to servers
62+ content = urllib .parse .unquote (content )
63+ # Drop newlines that can be used to bypass filter
64+ content = content .replace ("\n " , "" )
65+ # Avoid escape characters
66+ content = content .replace ("\\ " , "" )
67+
68+ return INVISIBLE_RE .sub ("" , content )
6069
6170
6271def past_tense (word : str ) -> str :
You can’t perform that action at this time.
0 commit comments