Page MenuHomePhabricator

MediaWiki API imageinfo continuation leads to a dead loop
Closed, ResolvedPublicBUG REPORT

Description

Steps to replicate the issue (include links if applicable):

Invoke the following MediaWiki API request [ API Sandbox ]

https://commons.wikimedia.org/w/api.php
?action=query
&format=json
&prop=imageinfo
&titles=File%3AHarku%20m%C3%B5isa%20park.JPG
&formatversion=2
&iilimit=1

What happens?:

You will receive the following response

{
    "continue": {
        "iistart": "2013-06-05T14:45:37Z",    // <-- ???
        "continue": "||"
    },
    "query": {
        "pages": [
            {
                "pageid": 26499141,
                "ns": 6,
                "title": "File:Harku mõisa park.JPG",
                "imagerepository": "local",
                "imageinfo": [
                    {
                        "timestamp": "2013-06-05T14:45:37Z",
                        "user": "Sumistaja"
                    }
                ]
            }
        ]
    }
}

Note how the $.continue.iistart is using the exactly same value as $.query.pages.[0].imageinfo.[0].timestamp.

If you feed the continuation parameters back to the request URL, you will basically receive exactly the same JSON response.

What should have happened instead?:

I expect $.continue.iistart to be something different that won't lead me to a dead continuation loop.

Actually, if I increase iilimit a bit, I will be able to guess why such weird continuation token gets returned. Invoke the following MediaWiki API request [ API Sandbox ]

https://commons.wikimedia.org/w/api.php
?action=query
&format=json
&prop=imageinfo
&titles=File%3AHarku%20m%C3%B5isa%20park.JPG
&formatversion=2
&iilimit=10

I will receive the following response

{
    "batchcomplete": true,
    "query": {
        "pages": [
            {
                "pageid": 26499141,
                "ns": 6,
                "title": "File:Harku mõisa park.JPG",
                "imagerepository": "local",
                "imageinfo": [
                    {
                        "timestamp": "2013-06-05T14:45:37Z",
                        "user": "Sumistaja"
                    },
                    {
                        "filemissing": true    // <-- [A]
                    }
                ]
            }
        ]
    }
}

I'm not sure whether this is related, but it seems the timestamp of missing file "[A]" (indicated by filemissing) has been removed since MW 1.34.

While I understand the reason behind the removal of the timestamp property that hasn't been populated with a meaningful value, probably you can consider using something different for continuation parameter, so at least we can move on.

Software version (on Special:Version page; skip for WMF-hosted wikis like Wikipedia):

Other information (browser name/version, screenshots, etc.):

Related

Event Timeline

For me it looks like a duplicate of T67251, but as you have linked it, maybe it is not.

The missing timestamp is also part of T239213

MW-Interfaces-Team will take a look at this too see if there's an API specific solution, or if it's really at the storage layer.

aaron claimed this task.