Fomafix has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/405609 )

Change subject: [WIP] API: Allow to pass whitespaces in MultiValue
......................................................................

[WIP] API: Allow to pass whitespaces in MultiValue

This allows to response with an invalidreason instead silently ignore
the parameter.

Example request: api.php?format=json&action=query&titles=%20

Response before this change:
{
  "batchcomplete": ""
}

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

Todo:
* Link a phabricator task.
* Check and add tests.

Change-Id: I6fdaf32792a0e6e37b08176f975c10607093351b
---
M includes/api/ApiBase.php
1 file changed, 0 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/09/405609/1

diff --git a/includes/api/ApiBase.php b/includes/api/ApiBase.php
index 1a126db..a030551 100644
--- a/includes/api/ApiBase.php
+++ b/includes/api/ApiBase.php
@@ -1408,9 +1408,6 @@
        protected function parseMultiValue( $valueName, $value, $allowMultiple, 
$allowedValues,
                $allSpecifier = null, $limit1 = null, $limit2 = null
        ) {
-               if ( ( trim( $value ) === '' || trim( $value ) === "\x1f" ) && 
$allowMultiple ) {
-                       return [];
-               }
                $limit1 = $limit1 ?: self::LIMIT_SML1;
                $limit2 = $limit2 ?: self::LIMIT_SML2;
 

-- 
To view, visit https://gerrit.wikimedia.org/r/405609
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I6fdaf32792a0e6e37b08176f975c10607093351b
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Fomafix <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to