Page MenuHomePhabricator

Manual does not mention how redirects are handled for API [prop=images]
Closed, DeclinedPublic

Description

I may be missing something but it appears that https://en.wikipedia.org/w/api.php?action=help&modules=query%2Bimages does not mention anything about redirects.

I.e. when I create a page with one or more file names that redirect to another file I want to know how the result of the query looks like.

Event Timeline

McZusatz raised the priority of this task from to Needs Triage.
McZusatz updated the task description. (Show Details)
McZusatz added a project: MediaWiki-Action-API.
McZusatz subscribed.
Anomie claimed this task.
Anomie subscribed.

That's outside the scope of what the auto-generated documentation provides. If you want to see what the query result looks like, try it out.

@Anomie thanks for the feedback. But if there is no place where the behavior is documented, there is also no way to find out if there is a bug in the API?

E.g. if I query a page with a file name in a <gallery> that redirect to another file I get both file names in the result. Is this wanted, and if yes. How would I find out which one is the redirected file name without doing another query?

But if there is no place where the behavior is documented, there is also no way to find out if there is a bug in the API?

Sure there is. It's just not as straightforward as "This doesn't match the documentation". OTOH, in that situation it could as well be a bug in the documentation so you still have to put some thought into it.

E.g. if I query a page with a file name in a <gallery> that redirect to another file I get both file names in the result. Is this wanted,

Yes. This is necessary for cascading protection to work correctly (i.e. T25542).

and if yes. How would I find out which one is the redirected file name without doing another query?

You could probably use prop=images as a generator somehow, if you're not already using a generator in the query and aren't fetching other props. Otherwise you'd just have to do another query.

Note image redirects are somewhat tricky to figure out, since the file description page might have #REDIRECT on it and generally be considered a redirect without the actual file being redirected.