Skip to content

Upgrade/Install: Decode character references in Shiny Updates console output - #13962

Open
anant1811 wants to merge 1 commit into
WordPress:trunkfrom
anant1811:59890-decode-console-entities
Open

anant1811 wants to merge 1 commit into
WordPress:trunkfrom
anant1811:59890-decode-console-entities

Conversation

@anant1811

Copy link
Copy Markdown

Upgrader debug messages from Shiny Updates are logged to the browser console via wp.sanitize.stripTagsAndEncodeText(), which intentionally returns HTML-escaped text. Because the console shows plain text, messages appear with raw character references, e.g. Unpacking the package….

This PR strips tags and decodes character references with DOMParser (body.textContent) before logging, and skips non-string messages. stripTagsAndEncodeText() itself is unchanged, as other callers rely on its escaped output. Decoding happens client-side only because the same messages are also used in emails/logs server-side.

Tests

  • Adds QUnit tests for wp.updates.ajaxAlways() (tests/qunit/wp-admin/js/updates-ajax-always.js): decoding, tag stripping, no markup execution, non-string skipping. They fail without the fix.
  • Loads updates.js in the QUnit suite and fixes the _wpUpdatesItemCounts fixture (totals lacked counts, which made refreshCount() throw on load).

Testing instructions

  1. Go to Plugins > Add New, open the browser console.
  2. Install any plugin.
  3. Before: Downloading installation package from …zip…. After: Downloading installation package from …zip….

Trac ticket: https://core.trac.wordpress.org/ticket/59890

Use of AI Tools

AI assistance: Yes
Tool(s): Claude Code
Model(s): Claude Opus 5.5
Used for: Investigation, implementation, tests and local verification, under my direction.


This Pull Request is for code review only. Please keep all other discussion in the Trac ticket. Do not merge this Pull Request. See GitHub Pull Requests for Code Review in the Core Handbook for more details.

🤖 Generated with Claude Code

https://claude.ai/code/session_014nJenDidRzoohF8JCEKbZ9

… output.

Upgrader debug messages logged to the browser console were passed through `wp.sanitize.stripTagsAndEncodeText()`, which returns HTML-escaped text. As the console displays plain text, messages such as "Unpacking the package&WordPress#8230;" were shown with the raw character reference.

This strips tags and decodes character references using `DOMParser` before logging, and skips non-string messages.

Includes QUnit tests for `wp.updates.ajaxAlways()`, and fixes the `_wpUpdatesItemCounts` test fixture so that `updates.js` can be loaded in the QUnit suite.

Fixes #59890.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014nJenDidRzoohF8JCEKbZ9
@github-actions

github-actions Bot commented Oct 3, 2026

Copy link
Copy Markdown

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

Unlinked Accounts

The following contributors have not linked their GitHub and WordPress.org accounts: @ashish.anant@a8c.com.

Contributors, please read how to link your accounts to ensure your work is properly credited in WordPress releases.

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@github-actions

github-actions Bot commented Oct 3, 2026

Copy link
Copy Markdown

Test using WordPress Playground

The changes in this pull request can previewed and tested using a WordPress Playground instance.

WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser.

Some things to be aware of

  • All changes will be lost when closing a tab with a Playground instance.
  • All changes will be lost when refreshing the page.
  • A fresh instance is created each time the link below is clicked.
  • Every time this pull request is updated, a new ZIP file containing all changes is created. If changes are not reflected in the Playground instance,
    it's possible that the most recent build failed, or has not completed. Check the list of workflow runs to be sure.

For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation.

Test this pull request with WordPress Playground.

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.

1 participant