Page MenuHomePhabricator

ApiQueryLinks ignores pltitles/tltemplates when empty
Closed, ResolvedPublic


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

Anomie created this task.Apr 12 2017, 5:06 PM
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptApr 12 2017, 5:06 PM

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

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 closed this task as Resolved.Jun 10 2017, 8:12 AM
Umherirrender triaged this task as Medium priority.
Umherirrender reopened this task as Open.Jun 10 2017, 8:35 AM
Anomie closed this task as Resolved.Jun 10 2017, 1:35 PM

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

Anomie reopened this task as Open.Oct 12 2017, 3:47 PM

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

Umherirrender closed this task as Resolved.Oct 12 2017, 5:10 PM

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