Special:Upload: Use user interface language for error message
authorFomafix <fomafix@googlemail.com>
Tue, 19 Apr 2016 16:32:50 +0000 (16:32 +0000)
committerUmherirrender <umherirrender_de.wp@web.de>
Sat, 20 Jan 2018 10:25:55 +0000 (10:25 +0000)
This change adds the parameters errorformat=html and errorlang with the user
interface language code to the API request.

Bug: T133059
Change-Id: I75b3c9537a8805367d36a4e51453a9f9219c9555

resources/src/mediawiki.special/mediawiki.special.upload.js

index 5934278..9bf6255 100644 (file)
@@ -73,7 +73,9 @@
                                // If title is empty, user input is invalid, the API call will produce details about why
                                titles: title ? title.getPrefixedText() : this.nameToCheck,
                                prop: 'imageinfo',
-                               iiprop: 'uploadwarning'
+                               iiprop: 'uploadwarning',
+                               errorformat: 'html',
+                               errorlang: mw.config.get( 'wgUserLanguage' )
                        } ).done( function ( result ) {
                                var
                                        resultOut = '',
@@ -81,7 +83,7 @@
                                if ( page.imageinfo ) {
                                        resultOut = page.imageinfo[ 0 ].html;
                                } else if ( page.invalidreason ) {
-                                       resultOut = mw.html.escape( page.invalidreason );
+                                       resultOut = page.invalidreason.html;
                                }
                                uploadWarning.processResult( resultOut, uploadWarning.nameToCheck );
                        } ).always( function () {