diff options
author | Mathieu Velten <mathieuv@matrix.org> | 2023-08-04 15:09:43 +0200 |
---|---|---|
committer | Mathieu Velten <mathieuv@matrix.org> | 2023-08-04 15:09:43 +0200 |
commit | 7c224e149bfb483d630a578213e5cf5ce87d6ecc (patch) | |
tree | 7ad3cfbaf02ca59b6881f18353efcdd4ed5fbddf | |
parent | Merge branch 'develop' into mv/add-mxid-validation-log (diff) | |
download | synapse-7c224e149bfb483d630a578213e5cf5ce87d6ecc.tar.xz |
fix comments
-rw-r--r-- | synapse/types/__init__.py | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/synapse/types/__init__.py b/synapse/types/__init__.py index bdbb5137d6..4010bf0805 100644 --- a/synapse/types/__init__.py +++ b/synapse/types/__init__.py @@ -331,6 +331,14 @@ class UserID(DomainSpecificString): SIGIL = "@" 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( @@ -383,9 +391,8 @@ def contains_invalid_mxid_characters( Args: localpart: the localpart to be checked - allow_legacy_mxids: True to use the extended allowed characters - from MSC4009. - + allow_historical_mxids: True to allow historical mxids, which can + include all printable ASCII chars minus `:` Returns: True if there are any naughty characters """ |