0
0
Fork 1
mirror of https://mau.dev/maunium/synapse.git synced 2024-06-09 06:08:56 +02: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:
Ryan Miguel 2022-10-24 08:55:06 -07:00 committed by GitHub
parent 872ea2f4de
commit 19c0e55ef7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 4 deletions

1
changelog.d/14262.misc Normal file
View file

@ -0,0 +1 @@
Provide a specific error code when a `/sync` request provides a filter which doesn't represent a JSON object.

View file

@ -146,12 +146,12 @@ class SyncRestServlet(RestServlet):
elif filter_id.startswith("{"):
try:
filter_object = json_decoder.decode(filter_id)
set_timeline_upper_limit(
filter_object, self.hs.config.server.filter_timeline_limit
)
except Exception:
raise SynapseError(400, "Invalid filter JSON")
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
)
filter_collection = FilterCollection(self.hs, filter_object)
else:
try: