diff options
author | Erik Johnston <erik@matrix.org> | 2016-01-20 15:40:25 +0000 |
---|---|---|
committer | Erik Johnston <erik@matrix.org> | 2016-01-20 15:40:25 +0000 |
commit | b088291f14cc1f021d68d3e1657952efef7fdfd0 (patch) | |
tree | 25c44bdafefa0f67ea6b8d4e9f3fe2660e42cc9d | |
parent | Merge pull request #510 from matrix-org/daniel/nonguestpeeking (diff) | |
download | synapse-b088291f14cc1f021d68d3e1657952efef7fdfd0.tar.xz |
Don't explode when given a unicode username in /register/
-rw-r--r-- | synapse/handlers/register.py | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/synapse/handlers/register.py b/synapse/handlers/register.py index 8e601b052b..1e99c1303c 100644 --- a/synapse/handlers/register.py +++ b/synapse/handlers/register.py @@ -49,11 +49,10 @@ class RegistrationHandler(BaseHandler): def check_username(self, localpart, guest_access_token=None): yield run_on_reactor() - if urllib.quote(localpart) != localpart: + if urllib.quote(localpart.encode('utf-8')) != localpart: raise SynapseError( 400, - "User ID must only contain characters which do not" - " require URL encoding.", + "User ID can only contain characters a-z, 0-9, or '-./'", Codes.INVALID_USERNAME ) |