Skip to content

fix: ignore malformed custom emoji entities - #1

Open
Luckylos wants to merge 1 commit into
TeleBoxOrg:masterfrom
Luckylos:pr/cjk-punctuation
Open

fix: ignore malformed custom emoji entities#1
Luckylos wants to merge 1 commit into
TeleBoxOrg:masterfrom
Luckylos:pr/cjk-punctuation

Conversation

@Luckylos

Copy link
Copy Markdown

Summary

  • Ignore malformed Telegram custom_emoji entities whose offset is outside the source text.
  • Preserve the original text and continue rendering instead of throwing from buildStyledChars.
  • Keep one bounded diagnostic warning with entity metadata; do not log the message body.

Motivation

A malformed custom-emoji entity currently dereferences styledChars[entity.offset] without checking the offset. This aborts text preparation and can discard an otherwise valid quote. The guard is limited to malformed entity input; valid custom-emoji entities keep the existing behavior.

Tests

  • node test-fixes.js
  • npm test
  • npm run test:visual — all 24 real rendering scenarios passed
  • npx eslint test-fixes.js utils/quote-generate/text-prepare.js
  • git diff --check

The repository-wide lint command still reports 35 pre-existing errors in unchanged files; the changed files pass targeted lint.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

1 participant