From d5b1ad03c48caaf55fe1fd54a1536d91d66c41ba Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Wed, 3 Dec 2008 21:52:40 +0000 Subject: [PATCH] * (bug 13342) importScript() generates more consistent URI encoding Switches order of URL to put title first, and encodes ':' and '/' consistently with MediaWiki general URI encoding. 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. --- RELEASE-NOTES | 1 + skins/common/wikibits.js | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 3c1d546bb5..6912fc5135 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -392,6 +392,7 @@ The following extensions are migrated into MediaWiki 1.14: pages if the repo wiki had a different canonical name for the File: namespace. Added 'fileNamespace' configuration item to $wgForeignFileRepos to override the local canonical name 'File' with another string. +* (bug 13342) importScript() generates more consistent URI encoding === API changes in 1.14 === diff --git a/skins/common/wikibits.js b/skins/common/wikibits.js index 6611c050fe..3a1cea9b37 100644 --- a/skins/common/wikibits.js +++ b/skins/common/wikibits.js @@ -48,7 +48,10 @@ function hookEvent(hookName, hookFunct) { } function importScript(page) { - return importScriptURI(wgScript + '?action=raw&ctype=text/javascript&title=' + encodeURIComponent(page.replace(/ /g,'_'))); + var uri = wgScript + '?title=' + + encodeURIComponent(page.replace(/ /g,'_')).replace('%2F','/').replace('%3A',':') + + '&action=raw&ctype=text/javascript'; + return importScriptURI(uri); } var loadedScripts = {}; // included-scripts tracker -- 2.20.1