Page MenuHomePhabricator

Use "&" instead of "\u0026" for urls in JS redirect pages (for easier copy/paste)
Open, LowestPublic

Description

Since T73200: Support redirects in JavaScriptContent was fixed, when I move a JS page and allow MW to create a redirect, it is created with a code such as

/* #REDIRECT */mw.loader.load("//pt.wikipedia.org/w/index.php?title=Usu%C3%A1rio(a):He7d3r/common.js\u0026action=raw\u0026ctype=text/javascript");

However, this usage of \u0026 makes it hard to copy the URL directly from the code, because we have to replace all \u0026 by & before pasting it somewhere.

Event Timeline

He7d3r created this task.Jul 29 2015, 2:53 PM
He7d3r raised the priority of this task from to Needs Triage.
He7d3r updated the task description. (Show Details)
He7d3r added a subscriber: He7d3r.
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptJul 29 2015, 2:54 PM
Aklapper triaged this task as Lowest priority.Jul 30 2015, 11:09 AM

This is automatically done by Xml::encodeJsCall -> Xml::encodeJsVar -> FormatJson::encode( ..., ..., FormatJson::UTF8_OK ). I don't know if there is a specific reason for it...

This is automatically done by Xml::encodeJsCall -> Xml::encodeJsVar -> FormatJson::encode( ..., ..., FormatJson::UTF8_OK ). I don't know if there is a specific reason for it...

Xml::escapeJsString() has encoded ampersands since 1.8 (rSVN15871 / rMW584c456a942fc8ae). Presumably, the reason is that within script elements in XHTML documents, ampersands must be encoded unless inside a CDATA section.

When I made Xml::encodeJsVar() instead use FormatJson::encode(), I grepped extensions and found a few that did not use Html::inlineScript(), so I decided to have FormatJson encode ampersands, as Xml::escapeJsString() had already done.

Change 267174 had a related patch set uploaded (by IoannisKydonis):
Use "&" instead of "\u0026".

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

Bawolff renamed this task from Use "&" instead of "\u0026" for easily copying URLs in JS pages to Use "&" instead of "\u0026" for urls in JS redirect pages (for easier copy/paste).Sep 9 2016, 4:14 AM
Bawolff set Security to None.
Restricted Application added a subscriber: TerraCodes. · View Herald TranscriptSep 9 2016, 4:14 AM
Framawiki moved this task from Backlog to Doing on the good first bug board.Dec 2 2017, 1:36 PM

Change 267174 abandoned by Thiemo Kreuz (WMDE):
Use "&" instead of "\u0026".

Reason:
This patch is incomplete and does not even touch the one line of code that creates these encoded ampersands, as explained by Krinkle in the last comment. Better start over, as a 2 years old incomplete draft won't help fixing the issue.

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