Skip to content

fix(mobile): prevent invalid HTML entities from crashing markdown - #6495

Merged
maria-rcks merged 1 commit into
pingdotgg:mainfrom
Lucenx9:agent/fix-mobile-invalid-html-entities
Aug 13, 2026
Merged

fix(mobile): prevent invalid HTML entities from crashing markdown#6495
maria-rcks merged 1 commit into
pingdotgg:mainfrom
Lucenx9:agent/fix-mobile-invalid-html-entities

Conversation

@Lucenx9

@Lucenx9 Lucenx9 commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

What Changed

Mobile's native Markdown renderer could throw when user or provider content contained a numeric HTML entity outside Unicode's valid code-point range.

Numeric entities are now range-checked before calling String.fromCodePoint. Valid decimal and hexadecimal entities still decode normally, while invalid ones remain literal. Focused tests cover valid, out-of-range, and double-encoded entities.

Why

An invalid entity could abort rendering and make the affected thread unavailable on mobile. Preserving malformed input as text keeps the renderer usable without changing valid Markdown output.

Checklist

  • This PR is small and focused
  • I explained what changed and why
  • I included before/after screenshots for any UI changes (not applicable; no UI changes)
  • I included a video for animation/interaction changes (not applicable; no animation or interaction changes)

Created with gpt-5.6-sol using the Codex harness in T3 Code.

Note

Fix invalid HTML entities crashing markdown by adding safe decodeCodePoint helper

Numeric HTML entities with out-of-range or non-integer code points previously caused a RangeError from String.fromCodePoint, crashing markdown rendering on mobile.

  • Adds a decodeCodePoint helper in nativeMarkdownText.ts that validates the code point is an integer within [0, 0x10FFFF] before calling String.fromCodePoint, returning the original entity string on failure.
  • Updates decodeHtmlEntitiesOnce to route decimal and hex numeric entity decoding through decodeCodePoint instead of calling String.fromCodePoint directly.
  • Extends the test suite with parameterized cases covering valid BMP/astral code points, out-of-range values, and ampersand-escaped numeric entities.

Macroscope summarized f3d2032.


Note

Low Risk
Small, localized change to entity decoding with tests; no auth, data, or API surface impact.

Overview
Numeric HTML entities that are out of Unicode range (or non-integers) no longer crash the mobile native markdown renderer. A new decodeCodePoint helper validates code points in [0, 0x10FFFF] before calling String.fromCodePoint; invalid values are left as the original entity string.

decodeHtmlEntitiesOnce now routes decimal and hex numeric entities through that helper instead of calling String.fromCodePoint directly. Tests cover valid BMP/astral entities, oversized values, and ampersand-escaped numeric forms.

Reviewed by Cursor Bugbot for commit f3d2032. Bugbot is set up for automated code reviews on this repo. Configure here.

@coderabbitai

coderabbitai Bot commented Aug 13, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 4d52542c-6bc7-42b9-a0b8-e59d83dcf761

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions github-actions Bot added vouch:unvouched PR author is not yet trusted in the VOUCHED list. size:S 10-29 changed lines (additions + deletions). labels Aug 13, 2026
@Lucenx9
Lucenx9 marked this pull request as ready for review August 13, 2026 16:19
@macroscopeapp

macroscopeapp Bot commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Approved f3d2032

Straightforward defensive bug fix that prevents crashes from invalid HTML entity code points. The validation wrapper has limited scope, clear intent, and comprehensive test coverage. No behavior change for valid inputs.

You can customize Macroscope's approvability policy. Learn more.

@maria-rcks
maria-rcks merged commit 83ad26c into pingdotgg:main Aug 13, 2026
23 checks passed
github-actions Bot added a commit to omarcresp/t3code-flake that referenced this pull request Aug 13, 2026
## What's Changed
* fix(mobile): prevent invalid HTML entities from crashing markdown by @Lucenx9 in pingdotgg/t3code#6495
* fix(web): avoid Clerk close button overlap by @t3-code[bot] in pingdotgg/t3code#6442
* fix(web): show unlinked icon when viewport aspect ratio is unlocked by @UtkarshUsername in pingdotgg/t3code#6509
* fix(web): scope pull request errors to their environment by @Adamulek123 in pingdotgg/t3code#6490
* fix(mobile): show a real settings cog in the Android sidebar header by @paul-vd in pingdotgg/t3code#6520

## New Contributors
* @Adamulek123 made their first contribution in pingdotgg/t3code#6490
* @paul-vd made their first contribution in pingdotgg/t3code#6520

**Full Changelog**: pingdotgg/t3code@v0.0.34-nightly.20260813.1087...v0.0.34-nightly.20260813.1088

Upstream release: https://github.com/pingdotgg/t3code/releases/tag/v0.0.34-nightly.20260813.1088
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:S 10-29 changed lines (additions + deletions). vouch:unvouched PR author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants