Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
317d8b66
Commit
317d8b66
authored
Sep 15, 2021
by
Brian Williams
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update error messaging to indicate file extension rather than MIME type
parent
507f5c2f
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
3 additions
and
3 deletions
+3
-3
app/models/user.rb
app/models/user.rb
+1
-1
locale/gitlab.pot
locale/gitlab.pot
+1
-1
spec/models/user_spec.rb
spec/models/user_spec.rb
+1
-1
No files found.
app/models/user.rb
View file @
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
...
...
locale/gitlab.pot
View file @
317d8b66
...
...
@@ -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"
...
...
spec/models/user_spec.rb
View file @
317d8b66
...
...
@@ -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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment