From 9d7c288d8699ed7a953a6a1445d9617b995c1935 Mon Sep 17 00:00:00 2001 From: pjay-io Date: Sun, 5 Apr 2026 10:44:13 -0700 Subject: [PATCH] fix(matrix): add filesize to nio.upload() for Synapse compatibility Cherry-picked from PR #4343 by pjay-io. Synapse rejects chunked uploads without Content-Length. Adding filesize=len(data) ensures the upload includes proper sizing. --- gateway/platforms/matrix.py | 1 + 1 file changed, 1 insertion(+) diff --git a/gateway/platforms/matrix.py b/gateway/platforms/matrix.py index 4f77e920a..8a3353033 100644 --- a/gateway/platforms/matrix.py +++ b/gateway/platforms/matrix.py @@ -604,6 +604,7 @@ class MatrixAdapter(BasePlatformAdapter): io.BytesIO(data), content_type=content_type, filename=filename, + filesize=len(data), ) if not isinstance(resp, nio.UploadResponse): err = getattr(resp, "message", str(resp))