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.

/thumbnail should return more obvious error when dynamic_thumbnails is disabled #13016

Closed
@MadLittleMods

Description

@MadLittleMods

Description:

Currently /thumbnail will return a 404 M_NOT_FOUND when dynamic_thumbnails is disabled in homeserver.yaml (it is disabled by default). The response code is pretty confusing because the media does exist, it just can't be dynamically thumbnailed. We should instead return a 400 M_UNKNOWN with a friendly error explaining why (already in spec).

Maybe this also depends on no thumbnail_sizes being defined in homeserver.yaml as well.

Actual

✅ Works: http://localhost:8008/_matrix/media/r0/download/hs1/tefQeZhmVxoiBfuFQUKRzJxc

❌ Doesn't load, 404: http://localhost:8008/_matrix/media/r0/thumbnail/hs1/tefQeZhmVxoiBfuFQUKRzJxc?width=400&height=195&method=scale

{
  "errcode": "M_NOT_FOUND",
  "error": "Not found [b'hs1', b'tefQeZhmVxoiBfuFQUKRzJxc']"
}

This really confused me because obviously the media does exist. The Synapse logs show:

2022-06-13 19:15:45,125 - synapse.rest.media.v1.thumbnail_resource - 382 - INFO - GET-319 - Failed to find any generated thumbnails

Expected

When dynamic_thumbnails is turned off, http://localhost:8008/_matrix/media/r0/thumbnail/hs1/tefQeZhmVxoiBfuFQUKRzJxc?width=400&height=195&method=scale should return 400 M_UNKNOWN

400: The request does not make sense to the server, or the server cannot thumbnail the content. For example, the client requested non-integer dimensions or asked for negatively-sized images.

-- https://spec.matrix.org/v1.1/client-server-api/#get_matrixmediav3thumbnailservernamemediaid

{
  "errcode": "M_UNKNOWN",
  "error": "Cannot find existing thumbnail for the requested content and cannot generate one because `dynamic_thumbnails` is disabled (see `homeserver.yaml`)"
}

Metadata

Metadata

Assignees

Labels

A-Media-RepositoryUploading, downloading images and video, thumbnailingA-Spec-Complianceplaces where synapse does not conform to the specS-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