Commit ff983381 authored by Luke Duncalfe's avatar Luke Duncalfe

Improve design filename validation error message

Previously this error message was output by Rails as:

  Filename Only these extensions are supported: png, jpg, jpeg, gif,
  bmp, tiff, and ico.

This changes the message to be:

  Filename has an unsupported extension. The extension must be png, jpg,
  jpeg, gif, bmp, tiff, or ico

https://gitlab.com/gitlab-org/gitlab/merge_requests/21615#note_261398477
parent 1fcfac98
......@@ -147,7 +147,7 @@ module DesignManagement
def validate_file_is_image
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
}
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
expect(design).not_to be_valid
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
......@@ -55,7 +55,7 @@ describe DesignManagement::Design do
expect(design).not_to be_valid
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
......
......@@ -12492,9 +12492,6 @@ msgstr ""
msgid "Only project members will be imported. Group members will be skipped."
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}."
msgstr ""
......@@ -21707,6 +21704,9 @@ msgstr ""
msgid "disabled"
msgstr ""
msgid "does not have a supported extension. Only %{extension_list} are supported"
msgstr ""
msgid "done"
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