tdesktop icon indicating copy to clipboard operation
tdesktop copied to clipboard

invoice image is not displayed when enlarged, if width & height attributes are not set

Open php4fan opened this issue 1 year ago • 5 comments

Steps to reproduce

  1. Have a bot send you an invoice where photo_url is the url of a PNG image (EDIT: see comment)
  2. click on the invoice thumbnail to see it enlarged

Expected behaviour

Either the image thumbnail should not be clickable in the first place if there was a good reason for it not being able to be enlarged (but that's not the case here), or, if it is clickable, should show the image in full size when clicked

Actual behaviour

When you click on the thumbnail, a partially transparent dark grey overlay covers the whole screen as if an image was going to be shown, but there's no image. The whole screen is being greyed out to show nothing. Note that this is never acceptable behavior. Even if there was a good reason for not being able to show the image, then you shouldn't grey out the screen and act as if you are showing an image: you should either not allow me to click it in the first place, or show some sort of error message (but here there's no reason for not showing the image properly).

If you click on the download icon to download the image, it will be saved with the .jpg extension, but it will still be saved as the original (which is a png), so the file extension won't match the actual image type. That gives me a clue of the possible cause of the bug: maybe you are assuming the image is a jpg, although nothing in the API documentation says it has to be.

Note that the mobile app behaves as expected, it shows the image full-screen when tapped.

Operating system

Manjaro Linux

Version of Telegram Desktop

4.12.2

Installation source

Static binary from official website

Crash ID

No response

Logs

No response

php4fan avatar Jan 11 '24 19:01 php4fan

Actually I've just tried with a jpg and I'm getting the same issue.

I guess I'll have to create a bot for you to reproduce the issue.

Anyway:

  • in any case where you are unable to display the image for whatever reason, you should handle it properly, i.e. at least not grey out the screen to display nothing
  • if there are any requirements that an invoice image need to satisfy, they should be documented (forward this to the team responsible for the API)

php4fan avatar Jan 11 '24 19:01 php4fan

It seems to happen when the bot doesn't set the optional parameters photo_width and photo_height in the sendInvoice request.

php4fan avatar Jan 11 '24 20:01 php4fan

Hey there!

This issue was inactive for a long time and will be automatically closed in 30 days if there isn't any further activity. We therefore assume that the user has lost interest or resolved the problem on their own.

Don't worry though; if this is an error, let us know with a comment and we'll be happy to reopen the issue.

Thanks!

github-actions[bot] avatar Jul 10 '24 01:07 github-actions[bot]

Again the stupid bot

php4fan avatar Jul 14 '24 10:07 php4fan

@raphtlw Your screenshot is from another app, Telegram Swift. Maybe it's better to set the dimensions then 🤔

john-preston avatar Aug 02 '24 14:08 john-preston