'redirects' not working for prop=imageinfo and commons redirects
Open, NormalPublic

Description

As I understand it, with prop=imageinfo and redirects, the API should follow redirects on commons too, but it doesn't seem to.

For example, the query

http://en.wikipedia.org/w/api.php?action=query&titles=File:Wodan%20Heilt%20Balders%20Pferd%20by%20Emil%20Doepler.jpg&prop=imageinfo&redirects

doesn't return any imageinfo, even though [[commons:File:Wodan Heilt Balders Pferd by Emil Doepler.jpg]] is a redirect to [[commons:File:Wodan heilt Balders Pferd by Emil Doepler.jpg]] (lowercase h).


Version: unspecified
Severity: normal

Details

Reference
bz45930
bzimport raised the priority of this task from to Normal.
bzimport set Reference to bz45930.
bzimport added a subscriber: Unknown Object (MLST).
Svick created this task.Mar 9 2013, 12:30 PM

A little brainstorming possible solutions, that won't re-cause some of the past bugs related to imageinfo and redirects:

  1. Make FileRepo::findFiles() use the passed-in titles as the keys in the result array, rather than the redirected title dbkeys.
  1. Make sure checkRedirect() works for all repos (e.g. it doesn't right now for ForeignAPIRepo), then in ApiQueryImageInfo if the title isn't found in the image array call that and check again.
  1. Give up on findFiles() entirely, and just call findFile() on each title. Removes the possibility for optimizing ForeignAPIRepo, but ForeignAPIRepo doesn't currently optimize anyway.

Note that ApiQueryDuplicateFiles and TimedMediaHandler's ApiQueryVideoInfo and ApiTranscodeStatus probably have the same sort of issues.

piotr.jagielski wrote:

Is there any workaround to get image info of a file redirected on commons by using the original image name until this issue is addressed?

Change 99738 had a related patch set uploaded by Aaron Schulz:
Tweaked FileRepo::findFiles() behavoir to match LocalRepo

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

Change 99738 merged by jenkins-bot:
Tweaked FileRepo::findFiles() behavoir to match LocalRepo

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

I'm going to look into trying to make file redirects behave like normal redirects (in regards to triggering on &redirects=1 and no special handling in imageinfo module)

Change 100921 had a related patch set uploaded by Brian Wolff:
[WIP] Make API follow file redirects like normal redirects

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

Anomie moved this task from Unsorted to In Dev on the MediaWiki-API board.Feb 19 2015, 7:11 PM

Change 100921 had a related patch set uploaded (by Paladox):
[WIP] Make API follow file redirects like normal redirects

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