From 5c98a49860e310b24b140d514b1767886e2c926a Mon Sep 17 00:00:00 2001 From: Erik Johnston Date: Wed, 14 Aug 2024 13:23:53 +0100 Subject: [PATCH 1/2] Fix zero length media handling --- synapse/media/media_storage.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/synapse/media/media_storage.py b/synapse/media/media_storage.py index cf4208eb710..c25d1a9ba36 100644 --- a/synapse/media/media_storage.py +++ b/synapse/media/media_storage.py @@ -544,7 +544,7 @@ def content_length(self) -> Optional[int]: Calculate the content length of the multipart response in bytes. """ - if not self.length: + if self.length is None: return None # calculate length of json field and content-type, disposition headers json_field = json.dumps(self.json_field) From bd3dbb8c8aad4d5313e9abb14024f2aa4f7f9273 Mon Sep 17 00:00:00 2001 From: Erik Johnston Date: Wed, 14 Aug 2024 13:26:44 +0100 Subject: [PATCH 2/2] Newsfile --- changelog.d/17570.bugfix | 1 + 1 file changed, 1 insertion(+) create mode 100644 changelog.d/17570.bugfix diff --git a/changelog.d/17570.bugfix b/changelog.d/17570.bugfix new file mode 100644 index 00000000000..e2964168b10 --- /dev/null +++ b/changelog.d/17570.bugfix @@ -0,0 +1 @@ +Fix bug where we would respond with an error when a remote server asked for media that had a length of 0, using the new multipart federation media endpoint.