[Mediawiki-api-announce] BREAKING CHANGE: Whitespace-only values to multi-valued parameters will no longer be considered empty sets

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[Mediawiki-api-announce] BREAKING CHANGE: Whitespace-only values to multi-valued parameters will no longer be considered empty sets

Brad Jorsch (Anomie)
There's an inconsistency in the handling of multi-value parameters where if you pass a value consisting of only whitespace[1] it will be interpreted as an empty set rather than as a single value consisting of whitespace. For example, https://www.mediawiki.org/w/api.php?action=query&titles= correctly handles the query as specifying no titles, but https://www.mediawiki.org/w/api.php?action=query&titles=%20 is also treated as specifying no titles rather than specifying a title consisting of a space character.

With Gerrit change 405609,[2] the behavior will be changed so that the latter query will behave more like https://www.mediawiki.org/w/api.php?action=query&titles=_ in reporting that the supplied title is invalid. The plan is that this will be deployed to WMF wikis with 1.31.0-wmf.20 on February 6–8, see https://www.mediawiki.org/wiki/MediaWiki_1.31/Roadmap for the schedule.

Passing an empty string as the value of a multi-valued parameter will continue to be treated as a set of zero elements rather than a one-element set containing the empty string.

Most clients should handle this change without major issue, as the resulting response is consistent with the response when any other invalid title is submitted. Clients that want to continue treating whitespace-only input as no input should begin checking for whitespace-only input before submitting it to the API.

[1]: Specifically: spaces (U+0020), tabs (U+0009), line feeds (U+000A), and carriage returns (U+000D).
[2]: https://gerrit.wikimedia.org/r/#/c/405609/

--
Brad Jorsch (Anomie)
Senior Software Engineer
Wikimedia Foundation

_______________________________________________
Mediawiki-api-announce mailing list
[hidden email]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-api-announce

_______________________________________________
Mediawiki-api mailing list
[hidden email]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-api