Last modified: 2012-05-01 19:36:03 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T38358, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 36358 - ApiQueryBase::titlePartToKey doesn't work correctly with the # character
ApiQueryBase::titlePartToKey doesn't work correctly with the # character
Status: NEW
Product: MediaWiki
Classification: Unclassified
API (Other open bugs)
1.20.x
All All
: Low normal (vote)
: ---
Assigned To: Nobody - You can work on this!
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2012-04-30 19:57 UTC by Svick
Modified: 2012-05-01 19:36 UTC (History)
5 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description Svick 2012-04-30 19:57:08 UTC
The function titlePartToKey in the class ApiQueryBase doesn't work correctly in the presence of the # character in the $titlePart paramter: the last character from the correct keyPart is removed. So, for example "WikiProject#" is converted to "WikiProjec".

This is because of the way the function tries to keep trailing spaces by appending "x" to the title and then removing it from the resulting key. The problem happens because titleToKey correctly removes everything after the # and substr then incorrectly removes some other character.

This happens for example in the query

http://en.wikipedia.org/w/api.php?format=xml&action=query&list=allpages&apnamespace=4&apprefix=WikiProject%23

which lists all pages in the namespace 4 whose name starts with WikiProjec (without t).

(Note: The # character has to be URL-encoded as %23 in the URL, otherwise browsers will treat it as an anchor.)
Comment 1 Umherirrender 2012-05-01 19:19:33 UTC
Page titles cannot contain #, therefore it makes no sense to query for that. But you are right, the api should work correct with that and not strip a character.
Comment 2 Svick 2012-05-01 19:36:03 UTC
Yeah. Now that I think about it, returning an error might make some sense in this case. Although it would be inconsistent with other modules that accept titles.

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links