Page MenuHomePhabricator

importScript() should not encode : or /
Closed, ResolvedPublic

Description

cirwin's version of importScript() used on the English Wiktionary results in path names with colons and slashes encoded as %3A and %2F which leads to a different cache entry to scripts imported manually using document.write().

If both versions are included it is hard to know which version will actually be called. For programmers it is easy to flush the wrong one when working on their code.


Version: unspecified
Severity: enhancement

Details

Reference
bz13342

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 21 2014, 10:07 PM
bzimport set Reference to bz13342.
bzimport added a subscriber: Unknown Object (MLST).

Now that importScript() is a part of core, has this been fixed in core, or is this still an issue?

The current implementation escapes ':' and '/', producing URLs like this:

/trunk/index.php?action=raw&ctype=text/javascript&title=MediaWiki%3ASysop.js

If we're recommending consistent use of importScript() it probably doesn't really matter, but it wouldn't hurt to be self-consistent with how we generate other URLs... of course even with the change to the encoding, the order of the pieces is different.

MediaWiki usually generates URLs with the title component first; also caching options will differ depending on who's generating the URL and when.

Have switched the order and the encoding to be more consistent. Applied in r44192.