diff options
author | Andrew Morgan <andrewm@element.io> | 2022-11-15 11:52:17 +0000 |
---|---|---|
committer | Andrew Morgan <andrew@amorgan.xyz> | 2022-12-19 16:44:24 +0000 |
commit | 47fe40b7caf4cc1792c8683fc29965fad97c2315 (patch) | |
tree | cd0982759478f4bb2ccf644833396b9bf167b5eb | |
parent | Allow deleting account data by PUT'ing with empty content (diff) | |
download | synapse-47fe40b7caf4cc1792c8683fc29965fad97c2315.tar.xz |
Return a 404 if an account data type is empty
-rw-r--r-- | synapse/rest/client/account_data.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/synapse/rest/client/account_data.py b/synapse/rest/client/account_data.py index 6d13be1a7c..a5779db0ed 100644 --- a/synapse/rest/client/account_data.py +++ b/synapse/rest/client/account_data.py @@ -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 |