summary refs log tree commit diff
path: root/synapse/rest/client
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2022-05-09 11:09:19 +0100
committerGitHub <noreply@github.com>2022-05-09 11:09:19 +0100
commitc5969b346d2694fea32ddd063ce40fec41028b57 (patch)
treed5f50ab042ae5bcf5b8ca8111095f57e14b325af /synapse/rest/client
parentdocs(contrib): Add link to documentation in dashboard (#12602) (diff)
downloadsynapse-c5969b346d2694fea32ddd063ce40fec41028b57.tar.xz
Don't error on unknown receipt types (#12670)
Fixes #12669
Diffstat (limited to 'synapse/rest/client')
-rw-r--r--synapse/rest/client/read_marker.py27
1 files changed, 15 insertions, 12 deletions
diff --git a/synapse/rest/client/read_marker.py b/synapse/rest/client/read_marker.py
index 1583e903cd..3644705e6a 100644
--- a/synapse/rest/client/read_marker.py
+++ b/synapse/rest/client/read_marker.py
@@ -16,7 +16,6 @@ import logging
 from typing import TYPE_CHECKING, Tuple
 
 from synapse.api.constants import ReceiptTypes
-from synapse.api.errors import SynapseError
 from synapse.http.server import HttpServer
 from synapse.http.servlet import RestServlet, parse_json_object_from_request
 from synapse.http.site import SynapseRequest
@@ -50,17 +49,21 @@ class ReadMarkerRestServlet(RestServlet):
 
         body = parse_json_object_from_request(request)
 
-        valid_receipt_types = {ReceiptTypes.READ, ReceiptTypes.FULLY_READ}
-        if self.config.experimental.msc2285_enabled:
-            valid_receipt_types.add(ReceiptTypes.READ_PRIVATE)
-
-        if set(body.keys()) > valid_receipt_types:
-            raise SynapseError(
-                400,
-                "Receipt type must be 'm.read', 'org.matrix.msc2285.read.private' or 'm.fully_read'"
-                if self.config.experimental.msc2285_enabled
-                else "Receipt type must be 'm.read' or 'm.fully_read'",
-            )
+        valid_receipt_types = {
+            ReceiptTypes.READ,
+            ReceiptTypes.FULLY_READ,
+            ReceiptTypes.READ_PRIVATE,
+        }
+
+        unrecognized_types = set(body.keys()) - valid_receipt_types
+        if unrecognized_types:
+            # It's fine if there are unrecognized receipt types, but let's log
+            # it to help debug clients that have typoed the receipt type.
+            #
+            # We specifically *don't* error here, as a) it stops us processing
+            # the valid receipts, and b) we need to be extensible on receipt
+            # types.
+            logger.info("Ignoring unrecognized receipt types: %s", unrecognized_types)
 
         read_event_id = body.get(ReceiptTypes.READ, None)
         if read_event_id: