Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Commit

Permalink
Don't 500 for invalid group IDs (#8628)
Browse files Browse the repository at this point in the history
  • Loading branch information
erikjohnston authored Oct 22, 2020
1 parent a9f90fa commit b19b63e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions changelog.d/8628.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix handling of invalid group IDs to return a 400 rather than log an exception and return a 500.
5 changes: 4 additions & 1 deletion synapse/handlers/groups_local.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
import logging

from synapse.api.errors import HttpResponseException, RequestSendFailed, SynapseError
from synapse.types import get_domain_from_id
from synapse.types import GroupID, get_domain_from_id

logger = logging.getLogger(__name__)

Expand All @@ -28,6 +28,9 @@ def _create_rerouter(func_name):
"""

async def f(self, group_id, *args, **kwargs):
if not GroupID.is_valid(group_id):
raise SynapseError(400, "%s was not legal group ID" % (group_id,))

if self.is_mine_id(group_id):
return await getattr(self.groups_server_handler, func_name)(
group_id, *args, **kwargs
Expand Down

0 comments on commit b19b63e

Please sign in to comment.