Consider this API call:
It gives an error "Exception Caught: Format text/plain is not supported for content model wikitext", which makes no sense because the content model passed was text rather than wikitext. It works fine if you remove the trailing newline (the %0A).
The problem turns out to be in TextContent::preSaveTransform: if there is trailing whitespace in the input then it returns a WikitextContent rather than a Content object of the same class as $this.
Version: 1.23.0
Severity: normal