Last modified: 2014-02-12 23:35:51 UTC
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).
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. 2. 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. 3. 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.
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