forked from MirrorHub/synapse
Return NOT_JSON if decode fails and defer set_timeline_upper_limit ca… (#14262)
* Return NOT_JSON if decode fails and defer set_timeline_upper_limit call until after check_valid_filter. Fixes #13661. Signed-off-by: Ryan Miguel <miguel.ryanj@gmail.com>. * Reword changelog
This commit is contained in:
parent
872ea2f4de
commit
19c0e55ef7
2 changed files with 5 additions and 4 deletions
1
changelog.d/14262.misc
Normal file
1
changelog.d/14262.misc
Normal file
|
@ -0,0 +1 @@
|
|||
Provide a specific error code when a `/sync` request provides a filter which doesn't represent a JSON object.
|
|
@ -146,12 +146,12 @@ class SyncRestServlet(RestServlet):
|
|||
elif filter_id.startswith("{"):
|
||||
try:
|
||||
filter_object = json_decoder.decode(filter_id)
|
||||
except Exception:
|
||||
raise SynapseError(400, "Invalid filter JSON", errcode=Codes.NOT_JSON)
|
||||
self.filtering.check_valid_filter(filter_object)
|
||||
set_timeline_upper_limit(
|
||||
filter_object, self.hs.config.server.filter_timeline_limit
|
||||
)
|
||||
except Exception:
|
||||
raise SynapseError(400, "Invalid filter JSON")
|
||||
self.filtering.check_valid_filter(filter_object)
|
||||
filter_collection = FilterCollection(self.hs, filter_object)
|
||||
else:
|
||||
try:
|
||||
|
|
Loading…
Reference in a new issue