1
0
Fork 0
mirror of https://github.com/element-hq/synapse.git synced 2025-03-31 03:45:13 +00:00
This commit is contained in:
Andrew Morgan 2025-03-28 15:56:24 +00:00 committed by GitHub
commit 57d1879f33
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 6 additions and 1 deletions
changelog.d
synapse/media

1
changelog.d/17864.misc Normal file
View file

@ -0,0 +1 @@
Prevent exception from receiving an invalid `Content-Type` response header upon fetching remote media.

View file

@ -961,7 +961,11 @@ class MediaRepository:
)
raise SynapseError(502, "Failed to fetch remote media")
if b"Content-Type" in headers:
if (
b"Content-Type" in headers
and len(headers[b"Content-Type"]) > 0
and headers[b"Content-Type"][0] is not None
):
media_type = headers[b"Content-Type"][0].decode("ascii")
else:
media_type = "application/octet-stream"