Page MenuHomePhabricator

ApiQueryLinks ignores pltitles/tltemplates when empty
Closed, ResolvedPublic

Description

The pltitles and tltemplates parameters are documented as "Only list links to these titles." But if given an empty list of titles or a list that contains only invalid titles, it will ignore the parameter entirely instead of limiting to the empty list (and therefore returning nothing).

Checking usage for March 2017, I see 560 hits with the parameter being the empty string. It looks like they're all from my own bot due to a bug that accidentally worked thanks to this bug, which I've now fixed.

Event Timeline

Change 347879 had a related patch set uploaded (by Anomie):
[mediawiki/core@master] ApiQueryLinks: Correctly handle empty pltitles/tltemplates

https://gerrit.wikimedia.org/r/347879

After looking around a bit further, it seems that ignoring these types of multi-valued parameters when they're empty is common practice in the API. But saying "pltitles=<bad>" should still limit to an empty list of titles.

Umherirrender triaged this task as Medium priority.

Fixed the invalid titles case. As mentioned in the previous comment, I decided not to change the behavior for an empty list.

... Why did I resolve this? The patch hasn't been merged yet.

Change 347879 merged by jenkins-bot:
[mediawiki/core@master] API: Handle pltitles/tltemplates/clcategories/imimages with only invalid titles

https://gerrit.wikimedia.org/r/347879