From b557833cc15a05f4402caf71c9a4010ebaa1541c Mon Sep 17 00:00:00 2001 From: Maxime Doutreluingne Date: Mon, 4 Apr 2022 10:47:13 +0200 Subject: [PATCH] [Validator] Fix of the description of the mime type message option --- reference/constraints/File.rst | 11 +---------- reference/constraints/Image.rst | 7 ++++++- .../_parameters-mime-types-message-option.rst.inc | 10 ++++++++++ 3 files changed, 17 insertions(+), 11 deletions(-) create mode 100644 reference/constraints/_parameters-mime-types-message-option.rst.inc diff --git a/reference/constraints/File.rst b/reference/constraints/File.rst index 1eaed6075d0..3b2ffcb6a14 100644 --- a/reference/constraints/File.rst +++ b/reference/constraints/File.rst @@ -259,16 +259,7 @@ You can find a list of existing mime types on the `IANA website`_. The message displayed if the mime type of the file is not a valid mime type per the `mimeTypes`_ option. -You can use the following parameters in this message: - -=============== ============================================================== -Parameter Description -=============== ============================================================== -``{{ file }}`` Absolute file path -``{{ name }}`` Base file name -``{{ type }}`` The MIME type of the given file -``{{ types }}`` The list of allowed MIME types -=============== ============================================================== +.. include:: /reference/constraints/_parameters-mime-types-message-option.rst.inc ``notFoundMessage`` ~~~~~~~~~~~~~~~~~~~ diff --git a/reference/constraints/Image.rst b/reference/constraints/Image.rst index 3beec73cdd1..d2c152fdfe0 100644 --- a/reference/constraints/Image.rst +++ b/reference/constraints/Image.rst @@ -442,7 +442,12 @@ You can find a list of existing image mime types on the `IANA website`_. ``mimeTypesMessage`` ~~~~~~~~~~~~~~~~~~~~ -**type**: ``string`` **default**: ``The mime type of the file is invalid ({{ type }}). Allowed mime types are {{ types }}.`` +**type**: ``string`` **default**: ``This file is not a valid image.`` + +The message ``The mime type of the file is invalid ({{ type }}). Allowed mime types are {{ types }}.`` will be displayed +if the allowed `mimeTypes`_ are only a subset of ``image/*``. + +.. include:: /reference/constraints/_parameters-mime-types-message-option.rst.inc ``minHeight`` ~~~~~~~~~~~~~ diff --git a/reference/constraints/_parameters-mime-types-message-option.rst.inc b/reference/constraints/_parameters-mime-types-message-option.rst.inc new file mode 100644 index 00000000000..0956b77a9c1 --- /dev/null +++ b/reference/constraints/_parameters-mime-types-message-option.rst.inc @@ -0,0 +1,10 @@ +You can use the following parameters in this message: + +=============== ============================================================== +Parameter Description +=============== ============================================================== +``{{ file }}`` Absolute file path +``{{ name }}`` Base file name +``{{ type }}`` The MIME type of the given file +``{{ types }}`` The list of allowed MIME types +=============== ==============================================================