fix(mobile): prevent invalid HTML entities from crashing markdown - #6495
Conversation
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
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. Comment |
ApprovabilityVerdict: 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. |
## 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
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
Created with gpt-5.6-sol using the Codex harness in T3 Code.
Note
Fix invalid HTML entities crashing markdown by adding safe
decodeCodePointhelperNumeric HTML entities with out-of-range or non-integer code points previously caused a
RangeErrorfromString.fromCodePoint, crashing markdown rendering on mobile.decodeCodePointhelper in nativeMarkdownText.ts that validates the code point is an integer within[0, 0x10FFFF]before callingString.fromCodePoint, returning the original entity string on failure.decodeHtmlEntitiesOnceto route decimal and hex numeric entity decoding throughdecodeCodePointinstead of callingString.fromCodePointdirectly.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
decodeCodePointhelper validates code points in[0, 0x10FFFF]before callingString.fromCodePoint; invalid values are left as the original entity string.decodeHtmlEntitiesOncenow routes decimal and hex numeric entities through that helper instead of callingString.fromCodePointdirectly. 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.