SchildiChat / SchildiChat-android

Matrix client / Element Android fork
https://schildi.chat/android/
Apache License 2.0
385 stars 49 forks source link

PNGs above a certain size will not display in encrypted rooms #197

Open Riven-Spell opened 1 year ago

Riven-Spell commented 1 year ago

Describe the bug PNGs above a certain size (so far as I can tell ~3000x4000 pixels) will not display properly in E2EE rooms.

To Reproduce Steps to reproduce the behavior:

  1. Create an E2EE room. (MUST be an E2EE room, will not reproduce unencrypted.)
  2. Send a high pixel count PNG (reliable reproduction on this image: https://img3.gelbooru.com//images/7c/b1/7cb1e85fd9ec5231b747fb2df82c1e5e.png) from another device.
  3. A empty frame should appear on mobile, and the image should have no preview in the chat uploads section.
  4. The download button will still work, the image will be viewable in another image viewing application.

I have yet to find any format other than PNG that is capable of reproducing this exact bug on SchildiChat.

Expected behavior The image should display properly.

Screenshots The first image is a lower res jpeg (1920x1080). This displays fine. The second image is a higher res png (4800x3400). This does not display. The third image is a even higher res jpeg (5016x3088). This displays fine. The fourth image is the same image as the second, but converted to webp (4800x3400). This displays fine. image image

Smartphone (please complete the following information):

Additional context

Upstream relevance

SpiritCroc commented 1 year ago

Thanks for investigating what works and what doesn't, that may help. I guess that the difference regarding encrypted vs non-encrypted rooms is, that the server is able to generate suitable thumbnails for display when images aren't encrypted.

Riven-Spell commented 1 year ago

I should note this bug doesn't reproduce in other clients, e.g. fluffychat. So maybe not server related(?)

When I was working with an element dev earlier, we narrowed it down to something going wrong w/ megolm E2EE. IIRC his client couldn't even decrypt the message. But that'd be upstream. We can chat and test things if you'd like to repro. @solstice:blatant-lizardry.moe

Screenshot_20230627-011414

SpiritCroc commented 1 year ago

I can reproduce with your linked image. Of course this is very likely a client issue, since everything works regarding downloading the image and opening externally, just the internal rendering is broken. The server thumbnail generation I mentioned is an additional mechanism that's available in non-encrypted rooms for getting a smaller picture to render in the timeline, which may explain why rendering is not broken there. I did not want to imply this could be a server issue, this doesn't sound like it would be at all. Also, since downloading works, this is very likely not an E2EE issue.

Riven-Spell commented 11 months ago

I should add some more context.

The images in question appear to display right during sending, but not upon arrival.