[GH-ISSUE #1126] [Bug]: Bare <speaker> tags (no name attribute) render as literal text #556

Closed
opened 2026-10-20 17:30:09 +07:00 by bsakaguchi · 1 comment
Owner

Originally created by @aeriondyseti on GitHub (May 24, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/1126

Originally assigned to: @cha1latte on GitHub.

What's happening

The plain-text rendering path in ChatMessage.tsx strips well-formed <speaker="Name">...</speaker> tags just fine, but bare <speaker>...</speaker> (no name attribute) slips through and shows up in the chat as literal text.

What should happen

Bare <speaker> tags should either be stripped like the named version, or filtered out upstream. Either's fine — consistency is what matters.

What actually happens

A message containing <speaker>hello</speaker> renders the literal characters <speaker>hello</speaker> in the message body.

Why it's happening

Two regexes in the file disagree about what a speaker tag looks like:

  • The pre-HTML-detection stripper (around line 562): /<\/?speaker(?:="[^"]*")?>/g — name attribute optional
  • The renderer's SPEAKER_TAG_RE (around line 250): /<speaker="([^"]*)">([\s\S]*?)<\/speaker>/g — name attribute required

The stripper removes wrappers from a temporary copy so it can decide whether the message contains "real" HTML, but it doesn't touch the original text. The plain-text branch then runs the stricter renderer regex against that unmodified text, fails to match bare tags, and they fall through to the highlighter unchanged.

How to reproduce

  1. Get a message into the chat that contains <speaker>some text</speaker> (without a name="..." attribute).
  2. The literal tag characters appear in the rendered message.

Possible fix

Pick a side and align the two regexes — either teach the renderer to accept bare tags (treat speaker as null), or require name attributes everywhere and sanitize the bare ones out earlier. The right choice probably depends on #1127 (the parse/render refactor) — that's a more natural place to settle this.


Surfaced during code review of #1125. Pre-existing, not introduced by that PR.

Originally created by @aeriondyseti on GitHub (May 24, 2026). Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/1126 Originally assigned to: @cha1latte on GitHub. ## What's happening The plain-text rendering path in `ChatMessage.tsx` strips well-formed `<speaker="Name">...</speaker>` tags just fine, but bare `<speaker>...</speaker>` (no `name` attribute) slips through and shows up in the chat as literal text. ## What should happen Bare `<speaker>` tags should either be stripped like the named version, or filtered out upstream. Either's fine — consistency is what matters. ## What actually happens A message containing `<speaker>hello</speaker>` renders the literal characters `<speaker>hello</speaker>` in the message body. ## Why it's happening Two regexes in the file disagree about what a speaker tag looks like: - The pre-HTML-detection stripper (around line 562): `/<\/?speaker(?:="[^"]*")?>/g` — name attribute optional - The renderer's `SPEAKER_TAG_RE` (around line 250): `/<speaker="([^"]*)">([\s\S]*?)<\/speaker>/g` — name attribute required The stripper removes wrappers from a temporary copy so it can decide whether the message contains "real" HTML, but it doesn't touch the original text. The plain-text branch then runs the stricter renderer regex against that unmodified text, fails to match bare tags, and they fall through to the highlighter unchanged. ## How to reproduce 1. Get a message into the chat that contains `<speaker>some text</speaker>` (without a `name="..."` attribute). 2. The literal tag characters appear in the rendered message. ## Possible fix Pick a side and align the two regexes — either teach the renderer to accept bare tags (treat speaker as null), or require name attributes everywhere and sanitize the bare ones out earlier. The right choice probably depends on #1127 (the parse/render refactor) — that's a more natural place to settle this. --- Surfaced during code review of #1125. Pre-existing, not introduced by that PR.
Author
Owner

@cha1latte commented on GitHub (May 25, 2026):

Closed in #1202

<!-- gh-comment-id:4536585220 --> @cha1latte commented on GitHub (May 25, 2026): Closed in #1202
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Pasta-Devs/Marinara-Engine#556
No description provided.