mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-05-13 21:52:12 -04:00
Respond with proper error responses on unknown paths. (#14621)
Returns a proper 404 with an errcode of M_RECOGNIZED for unknown endpoints per MSC3743.
This commit is contained in:
parent
da77720752
commit
9d8a3234ba
9 changed files with 32 additions and 14 deletions
|
@ -15,7 +15,9 @@
|
|||
import logging
|
||||
from typing import Dict
|
||||
|
||||
from twisted.web.resource import NoResource, Resource
|
||||
from twisted.web.resource import Resource
|
||||
|
||||
from synapse.http.server import UnrecognizedRequestResource
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
@ -49,7 +51,7 @@ def create_resource_tree(
|
|||
for path_seg in full_path.split(b"/")[1:-1]:
|
||||
if path_seg not in last_resource.listNames():
|
||||
# resource doesn't exist, so make a "dummy resource"
|
||||
child_resource: Resource = NoResource()
|
||||
child_resource: Resource = UnrecognizedRequestResource()
|
||||
last_resource.putChild(path_seg, child_resource)
|
||||
res_id = _resource_id(last_resource, path_seg)
|
||||
resource_mappings[res_id] = child_resource
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue