Skip to content

[Bug]: html_render titles can end on half an emoji at the 200-character limit #44659

Backlog

Description

@rune-gh

readHtmlRenderImage already refuses to end an image label on a lone high surrogate ("never end the label on half an emoji"). readHtmlRenderReference and the html_render publish path still use title.trim().slice(0, 200).

When the 200th UTF-16 unit is the first half of an emoji, the stored card title ends on a broken character.

Current

readHtmlRenderReference({ attachmentId, title: "a".repeat(199) + "🚀 more", height: 420 }).title is 199 as plus a lone high surrogate.

Expected

The title stops before the split character: 199 as, the same rule htmlRenderFileName and readHtmlRenderImage already use.

Steps

Run a unit test that calls readHtmlRenderReference with a title of 199 ASCII characters plus 🚀. The title should equal those 199 characters.

Environment

t3code main at 95c949c.

I have a fix with regression tests ready.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions