mirror of
https://git.anonymousland.org/anonymousland/synapse-product.git
synced 2024-10-01 08:25:44 -04:00
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
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("{"):
|
elif filter_id.startswith("{"):
|
||||||
try:
|
try:
|
||||||
filter_object = json_decoder.decode(filter_id)
|
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(
|
set_timeline_upper_limit(
|
||||||
filter_object, self.hs.config.server.filter_timeline_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)
|
filter_collection = FilterCollection(self.hs, filter_object)
|
||||||
else:
|
else:
|
||||||
try:
|
try:
|
||||||
|
Loading…
Reference in New Issue
Block a user