mirror of
https://github.com/element-hq/synapse.git
synced 2024-11-22 01:25:44 +03:00
Prevent exception when remote media Content-Type header value is None
This commit is contained in:
parent
a5e16a4ab5
commit
0f0259e60f
1 changed files with 5 additions and 1 deletions
|
@ -912,7 +912,11 @@ class MediaRepository:
|
||||||
)
|
)
|
||||||
raise SynapseError(502, "Failed to fetch remote media")
|
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")
|
media_type = headers[b"Content-Type"][0].decode("ascii")
|
||||||
else:
|
else:
|
||||||
media_type = "application/octet-stream"
|
media_type = "application/octet-stream"
|
||||||
|
|
Loading…
Reference in a new issue