Page MenuHomePhabricator

Incorrect articlepath and scriptpath returned for query&meta=siteinfo
Closed, DeclinedPublic

Description

Author: M8R-udfkkf

Description:
When querying siteinfo at http://en.wikipedia.org/w/api.php?action=query&meta=siteinfo,

It returns

<?xml version="1.0"?>
<api>

<query>
  <general mainpage="Main Page" base="http://en.wikipedia.org/wiki/Main_Page" sitename="Wikipedia" generator="MediaWiki 1.16alpha-wmf" phpversion="5.2.4-2ubuntu5.7wm1" phpsapi="apache2handler" dbtype="mysql" dbversion="5.1.43-wm3193-log" rev="59858" case="first-letter" rights="Creative Commons Attribution-Share Alike 3.0 Unported" lang="en" fallback8bitEncoding="windows-1252" writeapi="" timezone="UTC" timeoffset="0" articlepath="/wiki/$1" scriptpath="/w" script="/w/index.php" variantarticlepath="" server="http://en.wikipedia.org" wikiid="enwiki" />
</query>

</api>

Under articlepath, it returns "/wiki/$1" when it should return "/wiki/".

This is set by "$data['articlepath'] = $GLOBALS['wgArticlePath'];" in ApiQuerySiteinfo.php, so this is probably a problem in globals.


Version: unspecified
Severity: minor
URL: http://en.wikipedia.org/w/api.php?action=query&meta=siteinfo

Details

Reference
bz22609

Event Timeline

bzimport raised the priority of this task from to Lowest.Nov 21 2014, 11:04 PM
bzimport set Reference to bz22609.

M8R-udfkkf wrote:

Actually, scriptpath is also wrong, it should return "/w/". This is set by " $data['scriptpath'] = $GLOBALS['wgScriptPath'];", which is read from LocalSettings.php .

For scriptpath it should probably append a "/" to $GLOBALS['wgScriptPath'], so itd be $GLOBALS['wgScriptPath']."\"

M8R-udfkkf wrote:

(I meant "/" for the above one).

For server, should it also append an extra "/" so it'd give "http://en.wikipedia.org/" rather than "http://en.wikipedia.org".

In $wgArticlePath, $1 represents page title. See [[mw:Manual:$wgArticlePath]].

Why do you need that slash? Without it, we can concatenate them to make a URL easilier.

Bryan.TongMinh wrote:

Server should not have a slash, because it specifies the protocol and the host name. The latter slash is part of the path.

The $1 is in wgArticlePath because presumably the article name does not have to be the last part of the url.

Whether or not wgScriptPath should have a trailing slash can be discussed, however we are not going to break backwards compatibility for something that can be easily solved client side.