summary refs log tree commit diff
path: root/synapse/types.py
diff options
context:
space:
mode:
Diffstat (limited to 'synapse/types.py')
-rw-r--r--synapse/types.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/synapse/types.py b/synapse/types.py

index cc7c182a78..00e6e1c369 100644 --- a/synapse/types.py +++ b/synapse/types.py
@@ -229,6 +229,18 @@ def contains_invalid_mxid_characters(localpart): return any(c not in mxid_localpart_allowed_characters for c in localpart) +def strip_invalid_mxid_characters(localpart): + """Removes any invalid characters from an mxid + + Args: + localpart (basestring): the localpart to be stripped + + Returns: + localpart (basestring): the localpart having been stripped + """ + return filter(lambda c: c in mxid_localpart_allowed_characters, localpart) + + class StreamToken( namedtuple("Token", ( "room_key",