Commit 0c561756 authored by Matthias Käppler's avatar Matthias Käppler

Merge branch 'bwill/mime-type-error' into 'master'

Update error messaging to indicate file extension rather than MIME type

See merge request gitlab-org/gitlab!70374
parents 882f9f5d 317d8b66
......@@ -2112,7 +2112,7 @@ class User < ApplicationRecord
def check_username_format
return if username.blank? || Mime::EXTENSION_LOOKUP.keys.none? { |type| username.end_with?(".#{type}") }
errors.add(:username, _('ending with MIME type format is not allowed.'))
errors.add(:username, _('ending with a file extension is not allowed.'))
end
def groups_with_developer_maintainer_project_access
......
......@@ -39780,7 +39780,7 @@ msgstr ""
msgid "encrypted: needs to be a :required, :optional or :migrating!"
msgstr ""
msgid "ending with MIME type format is not allowed."
msgid "ending with a file extension is not allowed."
msgstr ""
msgid "entries cannot be larger than 255 characters"
......
......@@ -401,7 +401,7 @@ RSpec.describe User do
user = build(:user, username: "test.#{type}")
expect(user).not_to be_valid
expect(user.errors.full_messages).to include('Username ending with MIME type format is not allowed.')
expect(user.errors.full_messages).to include('Username ending with a file extension is not allowed.')
expect(build(:user, username: "test#{type}")).to be_valid
end
end
......
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