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
44f2c87d
Commit
44f2c87d
authored
Jun 27, 2019
by
Patrick Bajao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add regex validation on alias name
parent
ae7f16d8
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
1 deletion
+10
-1
ee/app/models/project_alias.rb
ee/app/models/project_alias.rb
+7
-1
ee/spec/models/project_alias_spec.rb
ee/spec/models/project_alias_spec.rb
+3
-0
No files found.
ee/app/models/project_alias.rb
View file @
44f2c87d
...
...
@@ -4,5 +4,11 @@ class ProjectAlias < ApplicationRecord
belongs_to
:project
validates
:project
,
presence:
true
validates
:name
,
presence:
true
,
uniqueness:
true
validates
:name
,
presence:
true
,
uniqueness:
true
,
format:
{
with:
::
Gitlab
::
PathRegex
.
project_path_format_regex
,
message:
::
Gitlab
::
PathRegex
.
project_path_format_message
}
end
ee/spec/models/project_alias_spec.rb
View file @
44f2c87d
...
...
@@ -10,4 +10,7 @@ describe ProjectAlias do
it
{
is_expected
.
to
validate_presence_of
(
:project
)
}
it
{
is_expected
.
to
validate_presence_of
(
:name
)
}
it
{
is_expected
.
to
validate_uniqueness_of
(
:name
)
}
it
{
is_expected
.
not_to
allow_value
(
'/foo'
).
for
(
:name
)
}
it
{
is_expected
.
not_to
allow_value
(
'foo/foo'
).
for
(
:name
)
}
it
{
is_expected
.
not_to
allow_value
(
'foo.git'
).
for
(
:name
)
}
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