Skip to content

fix: match commands after non-ASCII text - #321

Merged
negasus merged 1 commit into
go-telegram:mainfrom
INKCR0W:fix-command-entity-offsets
Nov 23, 2026
Merged

negasus merged 1 commit into
go-telegram:mainfrom
INKCR0W:fix-command-entity-offsets

Conversation

@INKCR0W

@INKCR0W INKCR0W commented Nov 19, 2026

Copy link
Copy Markdown
Contributor

Telegram counts entity offsets and lengths in UTF-16 code units, but extractCommand used them as byte indices. So a command after any non-ASCII text, like привет /help or 👋 /start, was sliced wrong and never matched a MatchTypeCommand handler.

This converts the offset and length to byte indices before slicing. ASCII text gives the same result as before, and an entity that starts or ends inside a surrogate pair is rejected.

@codecov-commenter

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 63.35%. Comparing base (d23f36c) to head (e56d7df).
❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #321      +/-   ##
==========================================
+ Coverage   63.16%   63.35%   +0.19%     
==========================================
  Files          40       40              
  Lines        3404     3417      +13     
==========================================
+ Hits         2150     2165      +15     
+ Misses       1195     1194       -1     
+ Partials       59       58       -1     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@negasus
negasus merged commit 4a980ee into go-telegram:main Nov 23, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants