Don't explode when given a unicode username in /register/

pull/513/head
Erik Johnston 2016-01-20 15:40:25 +00:00
parent a2ae01cc0f
commit b088291f14
1 changed files with 2 additions and 3 deletions

View File

@ -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
)