Page MenuHomePhabricator

HTML entities are double-escaped in watchlist filters
Closed, ResolvedPublicBUG REPORT

Description

Steps to replicate the issue (include links if applicable):

  • Add a label with HTML in it, e.g. <em>An emphatic label</em>
  • Add this label to some watchlist items
  • Filter by this label

A similar bug can be seen with namespaces, e.g. $wgExtraNamespaces[516] = 'Lorem & ipsum'; (in LocalSettings.php) and tags, e.g. &tagfilter=Lorem+%26+ipsum (in the Special:Watchlist URL).

Also, labels in a script in the opposite direction of the UI language do not display differently between Special:Watchlist and Special:WatchlistLabels. For example, ויקידאטא Q12345.

What happens?:

The label is displayed incorrectly in the filter bar on Special:Watchlist.

image.png (150×967 px, 30 KB)

What should have happened instead?:

It should be displayed as it is in the other places labels are displayed.

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald Transcript

It looks like the issue applies to namespaces and tags as well:

image.png (71×587 px, 7 KB)

Samwilson updated the task description. (Show Details)

Change #1233589 had a related patch set uploaded (by Samwilson; author: Samwilson):

[mediawiki/core@master] Watchlist: do not double-escape labels, and always use `<bdi>`

https://gerrit.wikimedia.org/r/1233589

Change #1233589 merged by jenkins-bot:

[mediawiki/core@master] Watchlist: do not double-escape labels, and always use `<bdi>`

https://gerrit.wikimedia.org/r/1233589

Change #1233688 had a related patch set uploaded (by Samtar; author: Samwilson):

[mediawiki/core@wmf/1.46.0-wmf.13] Watchlist: do not double-escape labels, and always use `<bdi>`

https://gerrit.wikimedia.org/r/1233688

Change #1233688 merged by jenkins-bot:

[mediawiki/core@wmf/1.46.0-wmf.13] Watchlist: do not double-escape labels, and always use `<bdi>`

https://gerrit.wikimedia.org/r/1233688

Mentioned in SAL (#wikimedia-operations) [2026-01-27T13:46:26Z] <samtar@deploy2002> Started scap sync-world: Backport for [[gerrit:1233688|Watchlist: do not double-escape labels, and always use <bdi> (T415489)]]

Mentioned in SAL (#wikimedia-operations) [2026-01-27T13:48:30Z] <samtar@deploy2002> samtar: Backport for [[gerrit:1233688|Watchlist: do not double-escape labels, and always use <bdi> (T415489)]] synced to the testservers (see https://wikitech.wikimedia.org/wiki/Mwdebug). Changes can now be verified there.

Mentioned in SAL (#wikimedia-operations) [2026-01-27T13:53:31Z] <samtar@deploy2002> Finished scap sync-world: Backport for [[gerrit:1233688|Watchlist: do not double-escape labels, and always use <bdi> (T415489)]] (duration: 07m 05s)

TheresNoTime subscribed.

Fix merged to master & backported to .13 to roll on this weeks' train

Change #1234783 had a related patch set uploaded (by Samwilson; author: Samwilson):

[mediawiki/core@master] Watchlist: 2nd take at not double-escaping filter values

https://gerrit.wikimedia.org/r/1234783

Change #1234783 merged by jenkins-bot:

[mediawiki/core@master] Watchlist: 2nd take at not double-escaping filter values

https://gerrit.wikimedia.org/r/1234783

Change #1235780 had a related patch set uploaded (by Manvi Kesarwani; author: Manvi Kesarwani):

[mediawiki/core@master] Watchlist: do not double-escape labels in filters

https://gerrit.wikimedia.org/r/1235780

i have contributed in this task please check it . this is the gerrit link - https://gerrit.wikimedia.org/r/c/mediawiki/core/+/1235780

Thanks @Manvikesarwani09 but this task has actually already been completed, sorry! It's not been closed, because it's going though a quality assurance process.

In addition, it looks like your patch is a duplicate of r1233589 (which I made, and was incorrect).

Change #1235780 abandoned by Manvi Kesarwani:

[mediawiki/core@master] Watchlist: do not double-escape labels in filters

Reason:

already completed

https://gerrit.wikimedia.org/r/1235780

Change #1235780 restored by Manvi Kesarwani:

[mediawiki/core@master] Watchlist: do not double-escape labels in filters

https://gerrit.wikimedia.org/r/1235780

Change #1235780 abandoned by Manvi Kesarwani:

[mediawiki/core@master] Watchlist: do not double-escape labels in filters

Reason:

completed

https://gerrit.wikimedia.org/r/1235780

dom_walden subscribed.

I tested Special:Watchlist filters with labels with various wikitext and HTML. I see they are nicely handled in the "Active filters" section at the top.

html_escaping.png (794×1 px, 190 KB)

We already found that we don't handle labels in the watchlist list part nicely, as seen in the screenshot (T417606).