Page MenuHomePhabricator

{{fullurl:}} does not urlencode passed querystring
Open, LowPublic

Description

{{fullurl:foo|param=lorem ipsum}}
becomes
http://some.wiki.org/w/index.php?title=foo&param=lorem
instead of
http://some.wiki.org/w/index.php?title=foo&param=lorem%20ipsum

further dependency:

[{{fullurl:foo|param=lorem ipsum}} link name]
becomes
"ipsum link name" linking to http://some.wiki.org/w/index.php?title=foo&param=lorem
instead of
"link name" linking to http://some.wiki.org/w/index.php?title=foo&param=lorem%20ipsum


Version: 1.18.x
Severity: normal

Details

Reference
bz27972

Event Timeline

bzimport raised the priority of this task from to Low.Nov 21 2014, 11:28 PM
bzimport set Reference to bz27972.
bzimport added a subscriber: Unknown Object (MLST).

You have to url-encode the param part your self, because MediaWiki does not know if a character must urlencoded or not (in some case it is bad to encode = or & or %).
But the first gives
http://some.wiki.org/w/index.php?title=foo&param=lorem ipsum
so there is no trim.

Marking as INVALID per comment #1. The query string passed to fullurl as second argument is supposed to be urlencoded already. Encoding it again would break b/c on thousands of pages.

It would be possible to encode only the characters which are invalid in URLs, like spaces, similar to what a web browser does when you enter a URL.

Also, {{fullurl:}} shouldn't be sending invalid query strings through to
Title::getFullURL(), there should be some kind of validation on the input side.

Against which list you want validate the query string? It is the current behaviour, that the second param of fullurl has to be a urlencoded string. Changing this can break b/c.