mirror of
https://git.anonymousland.org/anonymousland/synapse-product.git
synced 2024-12-22 13:04:59 -05:00
Fix a potential bug of UnboundLocalError (#8329)
Replaced with less buggier control flow
This commit is contained in:
parent
a3f124b821
commit
53284c425e
1
changelog.d/8329.bugfix
Normal file
1
changelog.d/8329.bugfix
Normal file
@ -0,0 +1 @@
|
|||||||
|
Fix UnboundLocalError from occuring when appservices send malformed register request.
|
@ -431,11 +431,14 @@ class RegisterRestServlet(RestServlet):
|
|||||||
|
|
||||||
access_token = self.auth.get_access_token_from_request(request)
|
access_token = self.auth.get_access_token_from_request(request)
|
||||||
|
|
||||||
if isinstance(desired_username, str):
|
if not isinstance(desired_username, str):
|
||||||
result = await self._do_appservice_registration(
|
raise SynapseError(400, "Desired Username is missing or not a string")
|
||||||
desired_username, access_token, body
|
|
||||||
)
|
result = await self._do_appservice_registration(
|
||||||
return 200, result # we throw for non 200 responses
|
desired_username, access_token, body
|
||||||
|
)
|
||||||
|
|
||||||
|
return 200, result
|
||||||
|
|
||||||
# == Normal User Registration == (everyone else)
|
# == Normal User Registration == (everyone else)
|
||||||
if not self._registration_enabled:
|
if not self._registration_enabled:
|
||||||
|
Loading…
Reference in New Issue
Block a user