This repository was archived by the owner on Apr 26, 2024. It is now read-only.
This repository was archived by the owner on Apr 26, 2024. It is now read-only.
Handle missing Content-Type
for remote media #11044
Closed
Description
Synapse expects other homeservers to always provide the Content-Type
header when serving media. However, this header is not required by the spec (https://matrix.org/docs/spec/client_server/r0.6.1#id67) and Synapse raises an error when fetching media without a Content-Type
header.
As a solution, we could either:
- default to
application/octet-stream
when fetching media without aContent-Type
header. We do this for URL previews somewhere. - preserve the absence of the header by recording a
NULL
content type in the database. No schema changes are required. Some mypy-guided code fixes are needed to ensure we handle theseNULL
s correctly.
Note that regardless of the solution chosen, Synapse will not generate or serve thumbnails for any remote media without a Content-Type
header by default, even if the remote homeserver does have thumbnails.
https://sentry.matrix.org/sentry/synapse-matrixorg/issues/200963/