Return a 404 if an account data type is empty

This commit is contained in:
Andrew Morgan 2022-11-15 11:52:17 +00:00 committed by Andrew Morgan
parent 5c7d2e05e8
commit 47fe40b7ca

View file

@ -83,6 +83,11 @@ class AccountDataServlet(RestServlet):
if event is None:
raise NotFoundError("Account data not found")
# If experimental support for MSC3391 is enabled, then this endpoint should
# return a 404 if the content for an account data type is an empty dict.
if self._hs.config.experimental.msc3391_enabled and event == {}:
raise NotFoundError("Account data not found")
return 200, event
@ -209,6 +214,11 @@ class RoomAccountDataServlet(RestServlet):
if event is None:
raise NotFoundError("Room account data not found")
# If experimental support for MSC3391 is enabled, then this endpoint should
# return a 404 if the content for an account data type is an empty dict.
if self._hs.config.experimental.msc3391_enabled and event == {}:
raise NotFoundError("Room account data not found")
return 200, event