mediawiki.special.upload: Show an error message on "|"
authorFomafix <fomafix@googlemail.com>
Sun, 21 Jan 2018 14:41:30 +0000 (15:41 +0100)
committerFomafix <fomafix@googlemail.com>
Sun, 21 Jan 2018 14:41:30 +0000 (15:41 +0100)
This change prevents that "|" is interpreted as title separator and
shows the following message when the title contains a "|" character:

  The requested page title contains invalid characters: "|".

Before this change the following message is shown on this case:

  The requested page title is empty or contains only the name of a
  namespace.

Change-Id: If67ed573ea0b5c28c59a7d90e8581c4b67528450

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

index 9bf6255..c46d2e6 100644 (file)
@@ -71,7 +71,7 @@
                                formatversion: 2,
                                action: 'query',
                                // If title is empty, user input is invalid, the API call will produce details about why
-                               titles: title ? title.getPrefixedText() : this.nameToCheck,
+                               titles: [ title ? title.getPrefixedText() : this.nameToCheck ],
                                prop: 'imageinfo',
                                iiprop: 'uploadwarning',
                                errorformat: 'html',