summary refs log tree commit diff
diff options
context:
space:
mode:
authorAndrew Morgan <andrewm@element.io>2022-11-15 11:52:17 +0000
committerAndrew Morgan <andrew@amorgan.xyz>2022-12-19 16:44:24 +0000
commit47fe40b7caf4cc1792c8683fc29965fad97c2315 (patch)
treecd0982759478f4bb2ccf644833396b9bf167b5eb
parentAllow deleting account data by PUT'ing with empty content (diff)
downloadsynapse-47fe40b7caf4cc1792c8683fc29965fad97c2315.tar.xz
Return a 404 if an account data type is empty
-rw-r--r--synapse/rest/client/account_data.py10
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