-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
/thumbnail
should return more obvious error when dynamic_thumbnails
is disabled
#13016
Comments
Confused. If |
Maybe it's an additional separate bug. I am seeing this behavior with this Whenever media is uploaded, there are no errors in the logs (
This is from running the end-to-end tests at As a note, if you want to run those tests ( |
Can confirm that currently matrix.org doesn't generate thumbnails in many cases, while servers running synapse 1.60.0 seem to work correctly. Should we move this to a new issue? |
I agree that this seems to be a bug, but I'm not sure I agree entirely with the proposed solution — the wording in the spec makes it sound like the homeserver should return a larger thumbnail in one of the handful of specced sizes. e.g. requesting 400×195 should give me a 640×480 thumbnail. I guess this leaves the case where the client requests a thumbnail that is larger than the original, or is larger than the largest specced thumbnail size — maybe 400 would make sense here. |
Agreed 👍 and I think Synapse already does this in all of the But in this case, Synapse isn't generating any thumbnails on upload and we should have a better error message on why that may be. Created #13038 with a proposal. We can also separately fix up the Synapse bugs which are causing it not to generate the thumbnails -> #13039 |
Fix #13016 ## New error code and status ### Before Previously, we returned a `404` for `/thumbnail` which isn't even in the spec. ```json { "errcode": "M_NOT_FOUND", "error": "Not found [b'hs1', b'tefQeZhmVxoiBfuFQUKRzJxc']" } ``` ### After What does the spec say? > 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* Now with this PR, we respond with a `400` when we don't have thumbnails to serve and we explain why we might not have any thumbnails. ```json { "errcode": "M_UNKNOWN", "error": "Cannot find any thumbnails for the requested media ([b'example.com', b'12345']). This might mean the media is not a supported_media_format=(image/jpeg, image/jpg, image/webp, image/gif, image/png) or that thumbnailing failed for some other reason. (Dynamic thumbnails are disabled on this server.)", } ``` > Cannot find any thumbnails for the requested media ([b'example.com', b'12345']). This might mean the media is not a supported_media_format=(image/jpeg, image/jpg, image/webp, image/gif, image/png) or that thumbnailing failed for some other reason. (Dynamic thumbnails are disabled on this server.) --- We still respond with a 404 in many other places. But we can iterate on those later and maybe keep some in some specific places after spec updates/clarification: matrix-org/matrix-spec#1122 We can also iterate on the bugs where Synapse doesn't thumbnail when it should in other issues/PRs.
Description:
Currently
/thumbnail
will return a404
M_NOT_FOUND
whendynamic_thumbnails
is disabled inhomeserver.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 a400
M_UNKNOWN
with a friendly error explaining why (already in spec).Maybe this also depends on no
thumbnail_sizes
being defined inhomeserver.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
This really confused me because obviously the media does exist. The Synapse logs show:
Expected
When
dynamic_thumbnails
is turned off,http://localhost:8008/_matrix/media/r0/thumbnail/hs1/tefQeZhmVxoiBfuFQUKRzJxc?width=400&height=195&method=scale
should return400
M_UNKNOWN
The text was updated successfully, but these errors were encountered: