Page MenuHomePhabricator

Querying `fileextensions` from siteinfo should be formatted as an array
Closed, DeclinedPublic

Description

Currently, querying the file extensions on a site returns an array of objects in the form "ext": "foo". Instead, this should simply be an array of the extensions, like how functionhooks are shown.

Current output
{
    "batchcomplete": "",
    "query": {
        "fileextensions": [
            {
                "ext": "tiff"
            },
            {
                "ext": "tif"
            },
            {
                "ext": "png"
            },
            {
                "ext": "gif"
            },
            {
                "ext": "jpg"
            },
            {
                "ext": "jpeg"
            },
            {
                "ext": "webp"
            },
            {
                "ext": "xcf"
            },
            {
                "ext": "pdf"
            },
            {
                "ext": "mid"
            },
            {
                "ext": "ogg"
            },
            {
                "ext": "ogv"
            },
            {
                "ext": "svg"
            },
            {
                "ext": "djvu"
            },
            {
                "ext": "oga"
            },
            {
                "ext": "flac"
            },
            {
                "ext": "opus"
            },
            {
                "ext": "wav"
            },
            {
                "ext": "webm"
            },
            {
                "ext": "mp3"
            },
            {
                "ext": "midi"
            }
        ]
    }
}
Proposed output
{
    "batchcomplete": "",
    "query": {
        "fileextensions": [
            "tiff",
            "tif",
            "png",
            "gif",
            "jpg",
            "jpeg",
            "webp",
            "xcf",
            "pdf",
            "mid",
            "ogg",
            "ogv",
            "svg",
            "djvu",
            "oga",
            "flac",
            "opus",
            "wav",
            "webm",
            "mp3",
            "midi"
        ]
    }
}

Event Timeline

Anomie subscribed.

While you're probably right that that would make more sense here, this would be a breaking change for all clients currently using the fileextensions property. Absent a convincing reason to change this, I'm going to decline the task.

On the other hand, it would be nice if functionhooks had done objects like fileextensions currently does, as that would allow us to easily reflect the SFH_NO_HASH property in the API result (which Parsoid seems like it could have used).