Skip to content

Fix escaping of interpolated arguments in markup#2118

Merged
patriksvensson merged 1 commit into
spectreconsole:mainfrom
GrantTotinov:fix-1763-escape-interpolated
May 12, 2026
Merged

Fix escaping of interpolated arguments in markup#2118
patriksvensson merged 1 commit into
spectreconsole:mainfrom
GrantTotinov:fix-1763-escape-interpolated

Conversation

@GrantTotinov

Copy link
Copy Markdown
Contributor

Fixes #1763

  • I have read the Contribution Guidelines
  • I have checked that there isn't already another pull request that solves the above issue
  • All newly added code is adequately covered by tests
  • All existing tests are still running without errors

Changes

Previously, only string arguments were escaped in Markup.EscapeInterpolated.

This caused runtime crashes when non-string objects were interpolated and their ToString() output contained markup-sensitive characters (e.g. square brackets), which were then interpreted as markup.

This change ensures that all interpolated arguments are consistently converted to string and escaped before formatting, preventing unintended markup parsing and runtime exceptions.

A regression test was added for objects whose ToString() contains square brackets.


Please upvote 👍 this pull request if you are interested in it.

Copilot AI review requested due to automatic review settings May 6, 2026 18:17
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@GrantTotinov GrantTotinov force-pushed the fix-1763-escape-interpolated branch from f59f08e to fa2b54d Compare May 6, 2026 19:46

@patriksvensson patriksvensson left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

@patriksvensson patriksvensson merged commit a334da9 into spectreconsole:main May 12, 2026
3 checks passed
This was referenced Jun 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Interpolation crashes if object contains square brackets

2 participants