Page MenuHomePhabricator

API: Allow to pass whitespaces in MultiValue parameters
Closed, ResolvedPublic

Description

Currently the API tread MultiValue parameter like titles with a single value consists of whitespaces like a not preset parameter:

api.php?format=json&action=query&titles=%20 is the same like api.php?format=json&action=query and returns

{
  "batchcomplete": ""
}

This is inconsistent because on multiple values (separated by | or by %1f) a whitespace-only value can pass and generates an error message:

api.php?format=json&action=query&titles=%20|foo is responded with

{
  "batchcomplete": "",
  "query": {
    "pages": {
      "-2": {
        "ns": 0,
        "title": "foo",
        "missing": ""
      },
      "-1": {
        "title": " ",
        "invalidreason": "The requested page title is empty or contains only the name of a namespace.",
        "invalid": ""
      }
    }
  }
}

The missing query key in the response can also produce errors in precessing the response like in T185400.

Expected result: A whitespace-only single value should also pass the API and return an error message:

{
  "batchcomplete": "",
  "query": {
    "pages": {
      "-1": {
        "title": " ",
        "invalidreason": "The requested page title is empty or contains only the name of a namespace.",
        "invalid": ""
      }
    }
  }
}