Skip to content
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
@squahtx

Description

@squahtx

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 a Content-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 these NULLs 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/

Metadata

Metadata

Assignees

Labels

S-MinorBlocks non-critical functionality, workarounds exist.T-DefectBugs, crashes, hangs, security vulnerabilities, or other reported issues.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions