Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sending non-compressed photos crashes the conversation #138

Open
tripoflgb opened this issue Jun 6, 2021 · 3 comments
Open

Sending non-compressed photos crashes the conversation #138

tripoflgb opened this issue Jun 6, 2021 · 3 comments
Labels
bug Something that doesn't work as expected. bug-reproduced I was able to reproduce the bug.

Comments

@tripoflgb
Copy link

tripoflgb commented Jun 6, 2021

Please help fix error, add photo to product from Windows Telegram client or phone (selected file)

Worker 1895432016 | worker | Exception in <Worker 1895432016>: list index out of range
Traceback (most recent call last):
File "/root/garminbot/worker.py", line 254, in run
self.__admin_menu()
File "/root/garminbot/worker.py", line 1757, in __admin_menu
self.__products_menu()
File "/root/garminbot/worker.py", line 1966, in __products_menu
self.__edit_product_menu()
File "/root/garminbot/worker.py", line 2088, in __edit_product_menu
largest_photo = photo_list[0]
IndexError: list index out of range
z1

@tripoflgb tripoflgb added the bug Something that doesn't work as expected. label Jun 6, 2021
@Steffo99
Copy link
Owner

Steffo99 commented Jun 6, 2021

You sent a non-compressed photo, which greed doesn't support...

It's weird that python-telegram-bot considered it a photo, though...

I'll investigate when I have time.

@tripoflgb
Copy link
Author

If i send a non-compressed / compressed photo, please fix in next update.

@Steffo99 Steffo99 changed the title Error add photo to product from Windows Telegram or Phone Sending non-compressed photos crashes the conversation Jun 6, 2021
@Steffo99 Steffo99 added the bug-reproduced I was able to reproduce the bug. label Aug 2, 2021
@Steffo99
Copy link
Owner

Steffo99 commented Aug 2, 2021

I think it's due to the Bot API 5.3 update.

Now photos have a different JSON structure, so trying to access the PhotoSize array fails.

I think that something should be changed here:

greed/worker.py

Lines 1067 to 1070 in 28967de

largest_photo = photo_list[0]
for photo in photo_list[1:]:
if photo.width > largest_photo.width:
largest_photo = photo

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something that doesn't work as expected. bug-reproduced I was able to reproduce the bug.
Projects
None yet
Development

No branches or pull requests

2 participants