mirror of
https://github.com/element-hq/synapse.git
synced 2025-03-31 03:45:13 +00:00
Merge b84c6dc33b
into 3c188231c7
This commit is contained in:
commit
57d1879f33
2 changed files with 6 additions and 1 deletions
1
changelog.d/17864.misc
Normal file
1
changelog.d/17864.misc
Normal file
|
@ -0,0 +1 @@
|
|||
Prevent exception from receiving an invalid `Content-Type` response header upon fetching remote media.
|
|
@ -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"
|
||||
|
|
Loading…
Add table
Reference in a new issue