Escape dynamic tooltip text before embedding in BBCode #61

Closed
opened 2026-04-22 23:50:44 -07:00 by nelsong6 · 1 comment
nelsong6 commented 2026-04-22 23:50:44 -07:00 (Migrated from github.com)

## Goal

Prevent CardUtilityStats tooltip BBCode from being broken by dynamic game/mod display text that contains square brackets.

Why this is real product behavior

The tooltip body is rendered through Godot RichTextLabel BBCode. Several rows combine trusted markup that CardUtilityStats owns, such as icons/tables/colors/bold tags, with dynamic display text from cards, powers/effects, and blocked-draw reason labels.

If a dynamic name contains text like [b], [color=red], or a stray [, the stats tooltip can accidentally format that text or corrupt the BBCode structure instead of showing the literal game/mod name.

Likely area

Start in:

  • Core/Patches/CardHoverTooltipPatch.cs
  • tooltip unit tests under Tests/CardUtilityStats.Core.Tests/

Likely dynamic strings to review include:

  • applied effect display names
  • blocked draw reason display names
  • any dynamic text passed through row/table helpers

Do not escape CardUtilityStats-owned BBCode markup such as [table], [img], [b], [color], etc. Escape only dynamic text before it is inserted into BBCode.

Acceptance criteria

  • Add a small BBCode escaping helper for dynamic tooltip text.
  • Use it where dynamic display names are embedded into BBCode labels.
  • Add focused unit tests that prove names such as Weird [b]Power[/b] render literally instead of becoming active BBCode.
  • Run the relevant test project.
  • Create a branch, commit, push, and open a PR.
  • Comment on this issue with the PR link and validation result.
## Goal Prevent CardUtilityStats tooltip BBCode from being broken by dynamic game/mod display text that contains square brackets. ## Why this is real product behavior The tooltip body is rendered through Godot `RichTextLabel` BBCode. Several rows combine trusted markup that CardUtilityStats owns, such as icons/tables/colors/bold tags, with dynamic display text from cards, powers/effects, and blocked-draw reason labels. If a dynamic name contains text like `[b]`, `[color=red]`, or a stray `[`, the stats tooltip can accidentally format that text or corrupt the BBCode structure instead of showing the literal game/mod name. ## Likely area Start in: - `Core/Patches/CardHoverTooltipPatch.cs` - tooltip unit tests under `Tests/CardUtilityStats.Core.Tests/` Likely dynamic strings to review include: - applied effect display names - blocked draw reason display names - any dynamic text passed through row/table helpers Do not escape CardUtilityStats-owned BBCode markup such as `[table]`, `[img]`, `[b]`, `[color]`, etc. Escape only dynamic text before it is inserted into BBCode. ## Acceptance criteria - Add a small BBCode escaping helper for dynamic tooltip text. - Use it where dynamic display names are embedded into BBCode labels. - Add focused unit tests that prove names such as `Weird [b]Power[/b]` render literally instead of becoming active BBCode. - Run the relevant test project. - Create a branch, commit, push, and open a PR. - Comment on this issue with the PR link and validation result.
nelsong6 commented 2026-04-22 23:54:33 -07:00 (Migrated from github.com)

Closing this generated test issue so we can use the existing Make It So queue candidate instead (#56).

Closing this generated test issue so we can use the existing Make It So queue candidate instead (#56).
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
romaine-life/spirelens#61
No description provided.