[Technical] Open stickers using the thumbnail url if the main url is empty #2157
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is a workaround for matrix-org/matrix-spec#1667
Several bridges (see mautrix/whatsapp#680) correctly send stickers as encrypted images but the spec doesn't cover that and the Rust SDK fails to parse them unless the url field is there (it can be an empty string)
This change makes sure the media viewer opens the sticker using the thumbnail url (if present) and it does not open if not (instead of trying to load an empty url and end with an error message)
Type of change
Content
Use the thumbnail url if the event's main url is empty
Motivation and context
Adding the real url might confuse other clients.
Screenshots / GIFs
Tests
OR
Copy the event and send it to a room manually adding the url field
Tested devices
Checklist