Commit 5faba4f5 authored by Thong Kuah's avatar Thong Kuah

Merge branch 'ld-improve-design-filename-validation-error' into 'master'

Improve validation message when a design extension is unsupported

See merge request gitlab-org/gitlab!21888
parents 2711b98e ff983381
...@@ -147,7 +147,7 @@ module DesignManagement ...@@ -147,7 +147,7 @@ module DesignManagement
def validate_file_is_image def validate_file_is_image
unless image? || (dangerous_image? && allow_dangerous_images?) unless image? || (dangerous_image? && allow_dangerous_images?)
message = _("Only these extensions are supported: %{extension_list}") % { message = _('does not have a supported extension. Only %{extension_list} are supported') % {
extension_list: valid_file_extensions.to_sentence extension_list: valid_file_extensions.to_sentence
} }
errors.add(:filename, message) errors.add(:filename, message)
......
---
title: Improve validation message when a design extension is unsupported
merge_request: 21888
author:
type: changed
...@@ -35,7 +35,7 @@ describe DesignManagement::Design do ...@@ -35,7 +35,7 @@ describe DesignManagement::Design do
expect(design).not_to be_valid expect(design).not_to be_valid
expect(design.errors[:filename].first).to eq( expect(design.errors[:filename].first).to eq(
"Only these extensions are supported: #{extensions.to_sentence}" "does not have a supported extension. Only #{extensions.to_sentence} are supported"
) )
end end
...@@ -55,7 +55,7 @@ describe DesignManagement::Design do ...@@ -55,7 +55,7 @@ describe DesignManagement::Design do
expect(design).not_to be_valid expect(design).not_to be_valid
expect(design.errors[:filename].first).to eq( expect(design.errors[:filename].first).to eq(
"Only these extensions are supported: #{described_class::SAFE_IMAGE_EXT.to_sentence}" "does not have a supported extension. Only #{described_class::SAFE_IMAGE_EXT.to_sentence} are supported"
) )
end end
end end
......
...@@ -12498,9 +12498,6 @@ msgstr "" ...@@ -12498,9 +12498,6 @@ msgstr ""
msgid "Only project members will be imported. Group members will be skipped." msgid "Only project members will be imported. Group members will be skipped."
msgstr "" msgstr ""
msgid "Only these extensions are supported: %{extension_list}"
msgstr ""
msgid "Only users with an email address in this domain can be added to the group.<br>Example: <code>gitlab.com</code>. Some common domains are not allowed. %{read_more_link}." msgid "Only users with an email address in this domain can be added to the group.<br>Example: <code>gitlab.com</code>. Some common domains are not allowed. %{read_more_link}."
msgstr "" msgstr ""
...@@ -21716,6 +21713,9 @@ msgstr "" ...@@ -21716,6 +21713,9 @@ msgstr ""
msgid "disabled" msgid "disabled"
msgstr "" msgstr ""
msgid "does not have a supported extension. Only %{extension_list} are supported"
msgstr ""
msgid "done" msgid "done"
msgstr "" msgstr ""
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment