Page MenuHomePhabricator

Encode '/' as part of the {{*E}} magic keywords like PAGENAMEE
Open, Needs TriagePublic

Description

The encoded titles like {{ARTICLEPAGENAMEE}} cannot be used in constructing URLs when they are used as part of the PATH rather than QUERY, because the '/' symbol is not escaped, thus breaking the URL's structure. This is highly useful for RESTy APIs like page views. See T129346 for an example.

Event Timeline

Yurik created this task.Mar 14 2016, 6:15 PM
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptMar 14 2016, 6:15 PM
matmarex renamed this task from Encode '/' as part of the {{*EE}} magic keywords like PAGENAMEE to Encode '/' as part of the {{*E}} magic keywords like PAGENAMEE.Mar 14 2016, 6:17 PM
Yurik added a comment.Mar 14 2016, 8:00 PM

Come to think of it, encoding '/' alone might not solve the problem. wfEscapeWikiText() escapes a lot more characters, and the '/' is only the more obvious one. Others include square brackets [ and ], ampersands, etc. We need a clear way to url PATH-encode article's title. Any suggestions?

{{urlencode:{{ARTICLEPAGENAME}}|PATH}} is the way to do (but not for ', see T18474 or T69196 for similar problems)

{{ARTICLEPAGENAMEE}} must be useable for linking to wiki pages, so it have to encode same thing than mediawiki does - that is not /

ARTICLEPAGENAME returns many characters as HTML encoded, so this is not an
option