summary refs log tree commit diff
diff options
context:
space:
mode:
authorMathieu Velten <mathieuv@matrix.org>2023-08-04 12:21:27 +0200
committerMathieu Velten <mathieuv@matrix.org>2023-08-04 12:21:27 +0200
commitdc9957dbbaa8c03e37e7497910ba58fc9e70a48e (patch)
tree218e176d3afd509e8541436ce738f296a06627d8
parentAdd changelog (diff)
downloadsynapse-dc9957dbbaa8c03e37e7497910ba58fc9e70a48e.tar.xz
Remove : from the historical localpart authorized chars
-rw-r--r--synapse/types/__init__.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/synapse/types/__init__.py b/synapse/types/__init__.py
index dffd98863d..bdbb5137d6 100644
--- a/synapse/types/__init__.py
+++ b/synapse/types/__init__.py
@@ -370,7 +370,7 @@ MXID_LOCALPART_ALLOWED_CHARACTERS = set(
     "_-./=+" + string.ascii_lowercase + string.digits
 )
 
-ASCII_PRINTABLE_CHARACTERS = set(string.printable)
+MXID_HISTORICAL_LOCALPART_ALLOWED_CHARACTERS = set(string.printable.replace(":", ""))
 
 # Guest user IDs are purely numeric.
 GUEST_USER_ID_PATTERN = re.compile(r"^\d+$")
@@ -391,7 +391,7 @@ def contains_invalid_mxid_characters(
     """
 
     if allow_historical_mxids:
-        allowed_characters = ASCII_PRINTABLE_CHARACTERS
+        allowed_characters = MXID_HISTORICAL_LOCALPART_ALLOWED_CHARACTERS
     else:
         allowed_characters = MXID_LOCALPART_ALLOWED_CHARACTERS
     return any(c not in allowed_characters for c in localpart)