element-hq / element-ios

A glossy Matrix collaboration client for iOS
https://element.io
GNU Affero General Public License v3.0
1.74k stars 497 forks source link

webp image without thumbnail doesn't show in several situation #4004

Open celogeek opened 3 years ago

celogeek commented 3 years ago

Describe the bug When we upload a webp image without a thumbnail, element on iOS doesn't display it.

To Reproduce

I use mautrix-signal.

  1. Go to signal
  2. Upload a webp

The content decrypted looks like:

{
  "room_id": "MY ROOT",
  "type": "m.room.message",
  "content": {
    "msgtype": "m.image",
    "body": "1_webp_ll.webp",
    "info": {
      "mimetype": "image/webp",
      "h": 301,
      "w": 400
    },
    "file": {
      "key": {...},
      "iv": "...",
      "hashes": {
        "sha256": "..."
      },
      "url": "mxc://...",
      "v": "v2"
    }
  }
}

The file.mimetype is not present there. It works on Desktop and Web without any problem.

When I copy the mimetype from the info section, the image display properly.

Then I try to send a sticker which has a special "type": "m.sticker".

It fail to display again.

I set it back to "m.room.message" and it works.

Expected behavior The info section is there to manage the filetype. We should not rely on the file.mimetype. The m.room.message or m.sticker should work the same way also.

Screenshots

Desktop (please complete the following information):

Smartphone (please complete the following information):

Additional context Add any other context about the problem here.

celogeek commented 3 years ago

https://github.com/tulir/mautrix-python/issues/43