summary refs log tree commit diff
diff options
context:
space:
mode:
authorMathieu Velten <mathieuv@matrix.org>2023-09-08 13:39:12 +0200
committerMathieu Velten <mathieuv@matrix.org>2023-09-08 13:39:12 +0200
commit5d0352c20786510a243a502ce47d55bafcb633e3 (patch)
tree1dc70360ff1a63aa14eaa5b165b2223a53cde556
parentMerge remote-tracking branch 'origin/develop' into mv/add-mxid-validation-log (diff)
downloadsynapse-github/mv/add-mxid-validation-log.tar.xz
-rw-r--r--synapse/types/__init__.py22
1 files changed, 0 insertions, 22 deletions
diff --git a/synapse/types/__init__.py b/synapse/types/__init__.py
index 9b7f4f0748..8b42ceee2b 100644
--- a/synapse/types/__init__.py
+++ b/synapse/types/__init__.py
@@ -362,28 +362,6 @@ class UserID(DomainSpecificString):
 
         return is_valid
 
-    def validate(self, allow_historical_mxids: Optional[bool] = False) -> bool:
-        """Validate an user ID against the spec.
-
-        Args:
-            allow_historical_mxids: True to allow historical mxids, which can
-            include all printable ASCII chars minus `:`
-        Returns:
-            True if the user ID is invalid per the spec
-        """
-        is_valid = True
-        if len(self.to_string().encode("utf-8")) > 255:
-            logger.warn(
-                f"User ID {self.to_string()} has more than 255 bytes and is invalid per the spec"
-            )
-            is_valid = False
-        if contains_invalid_mxid_characters(self.localpart, allow_historical_mxids):
-            logger.warn(
-                f"localpart of User ID {self.to_string()} contains invalid characters per the spec"
-            )
-            is_valid = False
-        return is_valid
-
 
 @attr.s(slots=True, frozen=True, repr=False)
 class RoomAlias(DomainSpecificString):