Skip to content

Conversation

@udf
Copy link

@udf udf commented Apr 13, 2018

Fixes the case where non-utf8 data would cause an exception and halt the dispatcher. See https://t.me/pythontelegrambotgroup/129353 for more info.

Note that the telegram docs at https://core.telegram.org/bots/api#callbackquery warn about this specific case ("Be aware that a bad client can send arbitrary data in this field.").

Fixes the case where non-utf8 data would cause an exception and halt the dispatcher. See https://t.me/pythontelegrambotgroup/129353 for more info.

Note that the telegram docs at https://core.telegram.org/bots/api#callbackquery warn about this specific case ("Be aware that a bad client can send arbitrary data in this field.").
@jh0ker
Copy link
Member

jh0ker commented Apr 14, 2018

Thanks a lot for your contribution @udf

The bug and fix look good, but it would be great to have a test to ensure we won't have regressions on this in the future.

I see you are a first-time contributor, would you like to add your name to the contributor list?

@Lonami
Copy link

Lonami commented Apr 14, 2018

How does one write tests for a single line change like this…? There should have been tests before the change, testing random bytes.

@jh0ker
Copy link
Member

jh0ker commented Apr 14, 2018

@Lonami If we had tests before, we would have caught the bug. Now we need a test (that would fail with the old code) to prevent this bug from happening again in case the code is changed in the future. The size of the diff doesn't really matter.

@jh0ker
Copy link
Member

jh0ker commented Apr 14, 2018

@udf A good test case would be to show that the correct exception is raised for a callback query that contains bytes that can't be decoded using the utf8 encoding

@Lonami
Copy link

Lonami commented Apr 14, 2018

I feel like we can open a separate issue to track that, this should be merged ASAP as it brings down any bots using the library. Unless you restart them automatically they will be down until you find out.

@udf
Copy link
Author

udf commented Apr 14, 2018

@jh0ker I don't have the time right now to figure out how to write a test. Perhaps someone else can do it, so we can get this merged quicker?

@udf
Copy link
Author

udf commented Apr 15, 2018

Closing this because apparently critical bug fixes aren't important enough.

@udf udf closed this Apr 15, 2018
@jh0ker
Copy link
Member

jh0ker commented Apr 15, 2018

I'm actually in the process of writing unit tests right now. If you don't want your commits merged, I'll commit the fix myself. Otherwise, feel free to reopen this PR.

@Lonami
Copy link

Lonami commented Apr 15, 2018

Thanks, we're just glad it will be fixed one way or another.

@github-actions github-actions bot locked and limited conversation to collaborators Aug 21, 2020
@Bibo-Joshi Bibo-Joshi added 🔌 bug pr description: bug and removed bug 🐛 labels Nov 3, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

🔌 bug pr description: bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants