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

Calculating button absolute path length in case with Cyrillic symbols #183

Closed
harimambura opened this issue Jun 22, 2022 · 2 comments
Closed
Labels
bug Something isn't working

Comments

@harimambura
Copy link
Contributor

Describe the bug
Absolute path length calculating in "renderCallbackButtonTemplate" of "keyborad.js" does not consider that Cyrillic characters are 2 bytes in utf-8 encoding, so therefore it is not possible to understand that the length of the path fits the telegram api limit

To Reproduce
Steps to reproduce the behavior:
just make a callback button with path at example "очень длинный абсолютный путь больше 32 символов"

Expected behavior
An error should be thrown

@harimambura harimambura added the bug Something isn't working label Jun 22, 2022
@EdJoPaTo
Copy link
Owner

Technically the error in this library is to provide something more readable than the Telegram API itself throws.

Do you have an idea on how to check the length of strings better? Want to provide a pull request there to improve it?

harimambura added a commit to harimambura/grammy-inline-menu that referenced this issue Jun 25, 2022
Fix calculating button absolute path length with non-Latin symbols according issue EdJoPaTo#183
@harimambura
Copy link
Contributor Author

With this error it's easier to debug which button is incorrect

Here my pull request

EdJoPaTo added a commit that referenced this issue Jul 13, 2022
* Fix calculating button absolute path length

Fix calculating button absolute path length with non-Latin symbols according issue #183

* refactor(xo): adapt to lints

* test(keyboard): add testcase for cyrillic path

* Fix testcase for cyrillic path

* test(keyboard): fix too long callback data

The testcase was done misleading which resulted in to many characters.
Therefore it did not test what it was supposed to test.

Co-authored-by: EdJoPaTo <rfc-conform-git-commit-email@funny-long-domain-label-everyone-hates-as-it-is-too-long.edjopato.de>
Co-authored-by: bekmambek <instreelus2@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants