Skip to content

Fix apostrophe in notification button content breaking XML#6239

Open
guimafelipe wants to merge 3 commits intomainfrom
user/felipeda/notifapostrophe
Open

Fix apostrophe in notification button content breaking XML#6239
guimafelipe wants to merge 3 commits intomainfrom
user/felipeda/notifapostrophe

Conversation

@guimafelipe
Copy link
Contributor

Summary

  • Applies EncodeXml() to m_content in AppNotificationButton::ToString() to properly escape special XML characters (apostrophes, ampersands, etc.)
  • All other fields (SetToolTip, SetInputId, text, combobox items) already use EncodeXml() — button content was the only one missing it

Fixes #4996

@guimafelipe
Copy link
Contributor Author

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Fixes invalid toast XML generation when AppNotificationButton content includes XML-special characters (notably apostrophes), preventing BuildNotification() failures like the COMException reported in #4996.

Changes:

  • Escape AppNotificationButton m_content via EncodeXml() when generating the <action content='...'> payload.
  • Add unit tests validating correct XML escaping for button content (apostrophe and other special characters).

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
test/AppNotificationBuilderTests/APITests.cpp Adds regression tests ensuring button content is XML-escaped in the generated toast payload.
dev/AppNotifications/AppNotificationBuilder/AppNotificationButton.cpp Applies EncodeXml() to button content during ToString() serialization to produce valid XML.

@guimafelipe guimafelipe marked this pull request as ready for review March 24, 2026 17:23
@guimafelipe
Copy link
Contributor Author

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

AppNotificationBuilder.BuildNotification fails with ComException when the character ' appears on an AppNotificationButton

2 participants