Thiemo Mättig (WMDE) has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/316575

Change subject: New error message for Commons files with illegal special 
characters
......................................................................

New error message for Commons files with illegal special characters

This was reported as "Illegal value" before.

Change-Id: I14c8d5ca0171a0fc90709dcf91153e7b3b148f78
---
M lib/i18n/en.json
M repo/i18n/en.json
M repo/i18n/qqq.json
M repo/includes/ValidatorBuilders.php
4 files changed, 8 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase 
refs/changes/75/316575/1

diff --git a/lib/i18n/en.json b/lib/i18n/en.json
index 7d37828..111c400 100644
--- a/lib/i18n/en.json
+++ b/lib/i18n/en.json
@@ -64,7 +64,7 @@
        "wikibase-validator-bad-value": "Data value corrupt: $1",
        "wikibase-validator-bad-value-type": "Bad value type $1, expected $2",
        "wikibase-validator-bad-data-type": "Bad data type: $1",
-       "wikibase-validator-bad-url": "URLs are not allowed to contain certain 
characters like spaces and square brackets: $1",
+       "wikibase-validator-bad-url": "URLs are not allowed to contain certain 
characters like spaces or square brackets: $1",
        "wikibase-validator-url-scheme-missing": "This URL misses a scheme like 
\"https://\": $1",
        "wikibase-validator-bad-url-scheme": "An URL scheme \"$1\" is not 
supported.",
        "wikibase-validator-unknown-unit": "Unknown unit: $1",
diff --git a/repo/i18n/en.json b/repo/i18n/en.json
index 177580b..57dc76d 100644
--- a/repo/i18n/en.json
+++ b/repo/i18n/en.json
@@ -120,6 +120,7 @@
        "wikibase-validator-label-conflict": "Property $3 already has label 
\"$1\" associated with language code $2.",
        "wikibase-validator-label-with-description-conflict": "Item $3 already 
has label \"$1\" associated with language code $2, using the same description 
text.",
        "wikibase-validator-label-no-entityid": "The label must not be a valid 
entity ID.",
+       "wikibase-validator-illegal-file-chars": "File names are not allowed to 
contain characters like colons or slashes. Only paste the file name after 
\"File:\", please.",
        "wikibase-validator-no-such-media": "The file \"$1\" does not exist on 
[https://commons.wikimedia.org/ Wikimedia Commons].",
        "wikibase-itemlink": "$1 $2",
        "wikibase-itemlink-id-wrapper": "($1)",
diff --git a/repo/i18n/qqq.json b/repo/i18n/qqq.json
index 2e4151b..e2fe596 100644
--- a/repo/i18n/qqq.json
+++ b/repo/i18n/qqq.json
@@ -151,6 +151,7 @@
        "wikibase-validator-label-conflict": "Error message shown when a user 
tries to save a property that has a non-unique label.\n\nParameters:\n* $1 - 
label text\n* $2 - the label's language code\n* $3 - the id of the property 
that already has the label\nSee also:\n* 
{{msg-mw|Wikibase-validator-label-with-description-conflict}}",
        "wikibase-validator-label-with-description-conflict": "Error message 
shown when a user tries to save an item that has a non-unique label+description 
pair.\n\nParameters:\n* $1 - label text\n* $2 - the label's language code\n* $3 
- the id of the item that already has the label and the description\nSee 
also:\n* {{msg-mw|Wikibase-validator-label-conflict}}",
        "wikibase-validator-label-no-entityid": "Error message shown when a 
user tries to save an item that has a valid entity id as label. Parameters:\n* 
$1 is the label.",
+       "wikibase-validator-illegal-file-chars": "Validator error message shown 
when a user tries to link to a Wikimedia Commons media file, but the file name 
contains illegal special characters such as slashes or colons. Parameters:\n* 
$1 - what the user entered.",
        "wikibase-validator-no-such-media": "Error message shown when a user 
tries to add a link to a Wikimedia Commons media file which does not exist. 
Parameters:\n* $1 is the name of the file.",
        "wikibase-itemlink": "{{optional}}\nused to generate the link text for 
links to items. $1 is the items label, $2 the id given to 
\"wikibase-itemlink-id-wrapper\". This message can be altered to change the 
position of the single parts within the link. Params:\n* $1 is label on a html 
form\n* $2 is id on a html form",
        "wikibase-itemlink-id-wrapper": "{{optional}}\nUsed to wrap the items 
id for a link to an item in parentheses or similar. Params:\n* $1 is the 
prefixed id of the item",
diff --git a/repo/includes/ValidatorBuilders.php 
b/repo/includes/ValidatorBuilders.php
index dfd8f79..c345d06 100644
--- a/repo/includes/ValidatorBuilders.php
+++ b/repo/includes/ValidatorBuilders.php
@@ -168,7 +168,11 @@
                // Must contain a non-empty file name with no nasty characters 
(see documentation of
                // $wgLegalTitleChars as well as $wgIllegalFileChars). File 
name extensions with digits
                // (e.g. ".jp2") are possible, as well as two characters (e.g. 
".ai").
-               $validators[] = new RegexValidator( 
'/^[^#\/:[\\\\\]{|}]+\.\w{2,}$/u' );
+               $validators[] = new RegexValidator(
+                       '/^[^#\/:[\\\\\]{|}]+\.\w{2,}$/u',
+                       false,
+                       'illegal-file-chars'
+               );
 
                if ( $checkExistence === 'checkExistence' ) {
                        $validators[] = new CommonsMediaExistsValidator( 
$this->mediaFileNameLookup );

-- 
To view, visit https://gerrit.wikimedia.org/r/316575
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I14c8d5ca0171a0fc90709dcf91153e7b3b148f78
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Wikibase
Gerrit-Branch: master
Gerrit-Owner: Thiemo Mättig (WMDE) <thiemo.maet...@wikimedia.de>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to