fix(matrix): Add file size to file upload, otherwise Synapse refuses media uploads (voice messages, etc.) - #4343
Closed
pjay-io wants to merge 2 commits into
Closed
fix(matrix): Add file size to file upload, otherwise Synapse refuses media uploads (voice messages, etc.)#4343pjay-io wants to merge 2 commits into
pjay-io wants to merge 2 commits into
Conversation
…media uploads (voice messages, etc.)
teknium1
pushed a commit
that referenced
this pull request
Apr 5, 2026
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.
Contributor
|
Merged via PR #5271. Your commit was cherry-picked with authorship preserved. Thanks for the Synapse fix! |
teknium1
pushed a commit
that referenced
this pull request
Apr 5, 2026
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.
Tommyeds
pushed a commit
to Tommyeds/hermes-agent
that referenced
this pull request
Apr 12, 2026
Cherry-picked from PR NousResearch#4343 by pjay-io. Synapse rejects chunked uploads without Content-Length. Adding filesize=len(data) ensures the upload includes proper sizing.
19 tasks
angelburgosrosado
pushed a commit
to angelburgosrosado/hermes-agent
that referenced
this pull request
Apr 27, 2026
Cherry-picked from PR NousResearch#4343 by pjay-io. Synapse rejects chunked uploads without Content-Length. Adding filesize=len(data) ensures the upload includes proper sizing.
1 task
02356abc
pushed a commit
to 02356abc/hermes-agent
that referenced
this pull request
May 14, 2026
Cherry-picked from PR NousResearch#4343 by pjay-io. Synapse rejects chunked uploads without Content-Length. Adding filesize=len(data) ensures the upload includes proper sizing.
gweeteve
pushed a commit
to gweeteve/hermes-agent
that referenced
this pull request
Jun 2, 2026
Cherry-picked from PR NousResearch#4343 by pjay-io. Synapse rejects chunked uploads without Content-Length. Adding filesize=len(data) ensures the upload includes proper sizing.
waefrebeorn
pushed a commit
to waefrebeorn/slermes
that referenced
this pull request
Jul 2, 2026
Cherry-picked from PR NousResearch#4343 by pjay-io. Synapse rejects chunked uploads without Content-Length. Adding filesize=len(data) ensures the upload includes proper sizing.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
Fixes media uploads to Synapse homeservers by passing
filesizetonio.upload().Matrix Synapse requires a
Content-Lengthheader on media uploads. Theniolibrary only sets this header whenfilesizeis explicitly passed toupload(). Without it, nio uses chunked transfer encoding which Synapse rejects, causing all media uploads (images, audio, video, files) to fail with "Request must specify a Content-Length". This also prevents voice message replies from working, since TTS audio files cannot be uploaded to Matrix.Related Issue
Fixes #4339
Type of Change
Changes Made
gateway/platforms/matrix.py: Addedfilesize=len(data)to thenio.upload()call in_upload_and_send(). This ensures theContent-Lengthheader is set on uploads, which Synapse requires.How to Test
Checklist
Code
fix(scope):,feat(scope):, etc.)pytest tests/ -qand all tests passDocumentation & Housekeeping
Screenshots / Logs