MediaWiki provides a way to fetch media from remote instances, which allows Wikipedias to use Media from Commons as if they were available in the wiki.
For example: https://commons.wikimedia.org/wiki/File:Into_Cwm_Du_-_geograph.org.uk_-_681141.jpg - is a File uploaded to commons, and do not exist on other wikis as local file. But thanks to wgForeignFileRepos configuration any wiki can list this file.
This makes this file available on wikis:
EN - http://en.wikipedia.org/wiki/File:Into_Cwm_Du_-_geograph.org.uk_-_681141.jpg
PL - https://pl.wikipedia.org/wiki/Plik:Into_Cwm_Du_-_geograph.org.uk_-_681141.jpg
DE - https://de.wikipedia.org/wiki/Datei:Into_Cwm_Du_-_geograph.org.uk_-_681141.jpg
There is a note on the page, that file comes from Commons, but sending an HTTP request to those URLs return Media page.
Now, the AttributionAPI doesn't support ForeignFileRepos, therefore Attribution for this file is only available in the source project:
- if we query commons https://commons.wikimedia.org/w/rest.php/attribution/v0-beta/pages/File:Into_Cwm_Du_-_geograph.org.uk_-_681141.jpg/signals we will get attribution information
- but if we query Attribution endpoint on English Wikipedia https://en.wikipedia.org/w/rest.php/attribution/v0-beta/pages/File:Into_Cwm_Du_-_geograph.org.uk_-_681141.jpg/signals we will get 404 not found.
Why this matters
The file information is returned in multiple ways, different extensions handle it differently. For example PageImages when queried for Bird ( https://en.wikipedia.org/w/api.php?action=query&generator=images&titles=Bird&prop=info) returns:
{ "batchcomplete": "", "continue": { "gimcontinue": "3410|Bar-tailed_Godwit_migration.jpg", "continue": "gimcontinue||" }, "query": { "pages": { "-1": { "ns": 6, "title": "File:17.6-24-1974-Cuerda-seca-flisepanel.jpg", "missing": "", "known": "", "contentmodel": "wikitext", "pagelanguage": "en", "pagelanguagehtmlcode": "en", "pagelanguagedir": "ltr" },
As you see it only lists Media as File:17.6-24-1974-Cuerda-seca-flisepanel.jpg. But it doesn't state if this file lives in commons or on local wiki.
If automated script decides to fetch the attribution for image, most likely it's going to use same domain and send request to https://en.wikipedia.org/w/rest.php/attribution/v0-beta/pages/File:17.6-24-1974-Cuerda-seca-flisepanel.jpg/signals. But this will end up with 404 not found, because this file do not exist on English Wikipedia.
To fetch file attribution script has to query Commons Attribution endpoint instead: https://commons.wikimedia.org/w/rest.php/attribution/v0-beta/pages/File:17.6-24-1974-Cuerda-seca-flisepanel.jpg/signals
Developer notes
File resolution in REST Handlers is processed in PageContentHelper and from initial check - looks like this code requires the Title to exist in current database.