From 871f51c270726fb76502570dcbf919ce747721d1 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 6 Feb 2024 09:29:17 +0000 Subject: Bump lxml-stubs from 0.4.0 to 0.5.1 (#16885) --- synapse/media/oembed.py | 5 ++--- synapse/media/preview_html.py | 3 +-- 2 files changed, 3 insertions(+), 5 deletions(-) (limited to 'synapse') diff --git a/synapse/media/oembed.py b/synapse/media/oembed.py index 94ece30459..16d613d271 100644 --- a/synapse/media/oembed.py +++ b/synapse/media/oembed.py @@ -256,12 +256,11 @@ def calc_description_and_urls(open_graph_response: JsonDict, html_body: str) -> parser = etree.HTMLParser(recover=True, encoding="utf-8") # Attempt to parse the body. If this fails, log and return no metadata. - # TODO Develop of lxml-stubs has this correct. - tree = etree.fromstring(html_body, parser) # type: ignore[arg-type] + tree = etree.fromstring(html_body, parser) # The data was successfully parsed, but no tree was found. if tree is None: - return # type: ignore[unreachable] + return # Attempt to find interesting URLs (images, videos, embeds). if "og:image" not in open_graph_response: diff --git a/synapse/media/preview_html.py b/synapse/media/preview_html.py index 8a2c098d53..62ce7789be 100644 --- a/synapse/media/preview_html.py +++ b/synapse/media/preview_html.py @@ -160,8 +160,7 @@ def decode_body( # Attempt to parse the body. Returns None if the body was successfully # parsed, but no tree was found. - # TODO Develop of lxml-stubs has this correct. - return etree.fromstring(body, parser) # type: ignore[arg-type] + return etree.fromstring(body, parser) def _get_meta_tags( -- cgit 1.5.1 From 71ca199165f8ec8d49691979628c1da2ebda9b4d Mon Sep 17 00:00:00 2001 From: David Baker Date: Tue, 6 Feb 2024 09:48:39 +0000 Subject: Accept unprefixed form of MSC3981 recurse parameter (#16842) Now that the MSC3981 has passed FCP --- changelog.d/16842.misc | 1 + synapse/rest/client/relations.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) create mode 100644 changelog.d/16842.misc (limited to 'synapse') diff --git a/changelog.d/16842.misc b/changelog.d/16842.misc new file mode 100644 index 0000000000..022ace7d95 --- /dev/null +++ b/changelog.d/16842.misc @@ -0,0 +1 @@ +Add support for stabilised [MSC3981](https://github.com/matrix-org/matrix-spec-proposals/pull/3981) that adds a `recurse` parameter on the `/relations` API. diff --git a/synapse/rest/client/relations.py b/synapse/rest/client/relations.py index e8dfeaa543..42da017f37 100644 --- a/synapse/rest/client/relations.py +++ b/synapse/rest/client/relations.py @@ -71,7 +71,7 @@ class RelationPaginationServlet(RestServlet): self._store, request, default_limit=5, default_dir=Direction.BACKWARDS ) if self._support_recurse: - recurse = parse_boolean( + recurse = parse_boolean(request, "recurse", default=False) or parse_boolean( request, "org.matrix.msc3981.recurse", default=False ) else: -- cgit 1.5.1