element-hq / element-meta

Shared/meta documentation and project artefacts for Element clients
76 stars 13 forks source link

Can't use ico or webp for avatars #2087

Open turt2live opened 7 years ago

turt2live commented 7 years ago

bounty

Description

When using an *.ico file, like this one, Riot tries the upload, considers it successful, and update the local avatar to match the new file. Once the settings pane is dismissed, the icon reverts to whatever it was before.

Steps to reproduce

I would have expected Riot to tell me it was an unsupported file type, or the icon change to work.

Log: not sent

After uploading image: image

After closing settings pane: image

Version information

Art10001 commented 7 years ago

This issue is fixed through extension renaming --rename the file from .ico to .png and it will work.

t3chguy commented 7 years ago

@Art10001 I think you mean worked around :P

t3chguy commented 7 years ago

Trying to use .ico for User Avatar has a fun behaviour works in Settings pane and works if you go to full image but because Synapse can't thumbnail the ico, it fails elsewhere

t3chguy commented 7 years ago

weirdly for me this did not revert the room Avatar, but entirely unset it

t3chguy commented 7 years ago

OH, looking at the original situation, that may be what happened (unless Travis really had a room with his face on)

t3chguy commented 7 years ago

This is insanity, so ICO does seem to thumbnail ok in some cases, but there is some...inconsistency

Fire up https://riot.ovh/_matrix/media/v1/download/riot.ovh/rowshuMtUMQCiabHbhCufWct?width=800&height=600 and refresh 10 times, you'll probably see multiple images...

agent3bood commented 7 years ago

I was looking into this and found that the server some times fail to thumbnail some images https://github.com/matrix-org/synapse/blob/master/synapse/rest/media/v1/thumbnailer.py

Now working on a solution which will use original image url in case thumbnail not available.

agent3bood commented 7 years ago

On the sdk https://github.com/matrix-org/matrix-js-sdk/blob/d76e8be4ffa5e4b9726660976be7be929bfe35a2/src/content-repo.js#L62 this function is returning /thumbnail url without checking if is exist on the server.

Does anybody know how to check if image is available on server before returning the url? couldn't find it myself.

turt2live commented 7 years ago

@agent3bood If the server returns an MXC URL, it should be available on the server.

riot-dev:matrix.org is probably the best place to ask these kinds of questions, as most people don't monitor the comments on github.

agent3bood commented 7 years ago

Please check https://github.com/matrix-org/matrix-react-sdk/pull/1485 This is my first PR here, be easy on me.

t3chguy commented 7 years ago

Only way to

Does anybody know how to check if image is available on server before returning the url? couldn't find it myself.

is to GET or HEAD the /thumbnail url

turt2live commented 6 years ago

Updated the OP to advertise the bounty :)

HarHarLinks commented 2 years ago

related https://github.com/matrix-org/matrix-spec/issues/453