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
59c808a6
Commit
59c808a6
authored
Jul 19, 2017
by
Grzegorz Bizon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add a test for container repository name regexp
parent
9f36012e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
0 deletions
+15
-0
lib/gitlab/regex.rb
lib/gitlab/regex.rb
+4
-0
spec/lib/gitlab/regex_spec.rb
spec/lib/gitlab/regex_spec.rb
+11
-0
No files found.
lib/gitlab/regex.rb
View file @
59c808a6
...
...
@@ -28,6 +28,10 @@ module Gitlab
@container_repository_regex
||=
%r{
\A
[a-z0-9]+(?:[-._/][a-z0-9]+)*
\Z
}
end
##
# We do not use regexp anchors here because these are not allowed when
# used as a routing constraint.
#
def
container_registry_tag_regex
@container_registry_tag_regex
||=
/[\w][\w.-]{0,127}/
end
...
...
spec/lib/gitlab/regex_spec.rb
View file @
59c808a6
...
...
@@ -38,4 +38,15 @@ describe Gitlab::Regex, lib: true do
it
{
is_expected
.
not_to
match
(
'9foo'
)
}
it
{
is_expected
.
not_to
match
(
'foo-'
)
}
end
describe
'.container_repository_name_regex'
do
subject
{
described_class
.
container_repository_name_regex
}
it
{
is_expected
.
to
match
(
'image'
)
}
it
{
is_expected
.
to
match
(
'my/image'
)
}
it
{
is_expected
.
to
match
(
'my/awesome/image-1'
)
}
it
{
is_expected
.
to
match
(
'my/awesome/image.test'
)
}
it
{
is_expected
.
not_to
match
(
'.my/image'
)
}
it
{
is_expected
.
not_to
match
(
'my/image.'
)
}
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