Page MenuHomePhabricator

Raw HTML from Language Converters' title conversion displayed in plaintext
Closed, ResolvedPublicBUG REPORT

Description

How to reproduce :

  • Go to any page that uses Language Converters' -{T|}- syntax to change title, Such as this

What happens?:
Raw HTML tag can be seen in the Title

What should have happened instead?:
Title should by styled by the html in the title

Whats the reason behind it:
Currently, you can put whatever you want in Language Converters' -{T|}- syntax including HTML syntax like magic word displaytitle without using displaytitle function in CoreParserFunctions.php.

When we need to process the title, the logic in Parser.php will call getTargetLanguageConverter()->getConvRuleTitle() and then using the string from convertTitle and set it as the new title using setTitleText. You can see the logic here.

However, due to the changes made in T291985, the string from convertTitle will pass through htmlspecialchars before setting as the new title, which causes display issue like this when we do not want them to be converted by htmlspecialchars.

Potential Solution:
One solution can be to convert title from getTargetLanguageConverter()->getConvRuleTitle() using displaytitle function in CoreParserFunctions.php, with adding benefits such as HTML sanitization.

Event Timeline

Change 735655 had a related patch set uploaded (by Fomafix; author: Fomafix):

[mediawiki/core@master] [WIP] Do not double HTML encode language converter display titles

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

So what happened to this task? Why it didn't mark weekly blocker tracking task? It truly broken something.

Krinkle subscribed.

Might be related to: T295187: Chinese conversion no longer work in the table of content.

Tagging Parsoid, which is afaik (still) how the Content-Transformation team discover and track (some) of their work.

IIUC, @Fomafix's patch fixes this problem. I don't see a reason not to +2. If there is a reason to not +2, this should be removed as a 1.38 blocker.

Changing to not a blocker re my previous comment.

@MarkAHershberger I think the reason there is no +2 is because no one with a +2 right have time or willing to review the patch.

I do not want to reverse your decision, but I believe this is a blocker for MW-1.38 as the change made by T291985 broke a core language converter feature Chinese Wikimedia projects and other project outside Wikimedia relies on. Since 1.38 is a LTS, unless someone will backport this patch then this should be a blocker.

I will follow up with @cscott and we'll figure out how to address this (review / patch).

I reviewed @Fomafix's patch shortly after it was written and made some comments, but they were never followed up on. Further, after my initial review some new code landed on master (and made it to 1.38) which would simplify what he was doing. So the patch needs to be updated, either by @Fomafix or @me or someone else.

Change 735655 merged by jenkins-bot:

[mediawiki/core@master] Fix output encoding of language converter display title

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

Change 735655 merged by jenkins-bot:

[mediawiki/core@master] Fix output encoding of language converter display title

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

Does this mean this task is now Resolved?

Can confirm this is resolved.