https://bugzilla.wikimedia.org/show_bug.cgi?id=58451

       Web browser: ---
            Bug ID: 58451
           Summary: TextContent::preSaveTransform shouldn't return a
                    WikitextContent when $this isn't a WikitextContent
           Product: MediaWiki
           Version: 1.23-git
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: Unprioritized
         Component: ContentHandler
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected]
    Classification: Unclassified
   Mobile Platform: ---

Consider this API call:

https://en.wikipedia.org/w/api.php?action=parse&text=Test%0A&pst=&onlypst=&contentformat=text%2Fplain&contentmodel=text

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.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
Wikibugs-l mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/wikibugs-l

Reply via email to