summaryrefslogtreecommitdiff
path: root/lib/container_registry
diff options
context:
space:
mode:
authorGrzegorz Bizon <grzesiek.bizon@gmail.com>2017-04-03 11:38:39 +0200
committerGrzegorz Bizon <grzesiek.bizon@gmail.com>2017-04-03 11:38:39 +0200
commit1a47986b3d7cd8e6d5bdbfbc20a841cf5586f773 (patch)
tree50d421d260f6ef1fb7d5d9f564494fe9d23d09bf /lib/container_registry
parent01280a5ad56f67ae653dade815faa5649bcee81f (diff)
downloadgitlab-ce-1a47986b3d7cd8e6d5bdbfbc20a841cf5586f773.tar.gz
Check registry repository name against regexp
This regexp is extracted from Docker Distribution 2.4.1 docs, contains additional `/` element that can be a separator of components.
Diffstat (limited to 'lib/container_registry')
-rw-r--r--lib/container_registry/path.rb4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/container_registry/path.rb b/lib/container_registry/path.rb
index 27e0e7897ff..6e8d62b77c7 100644
--- a/lib/container_registry/path.rb
+++ b/lib/container_registry/path.rb
@@ -22,7 +22,9 @@ module ContainerRegistry
end
def valid?
- @nodes.size > 1 && @nodes.size < Namespace::NUMBER_OF_ANCESTORS_ALLOWED
+ @path =~ Gitlab::Regex.container_repository_name_regex &&
+ @nodes.size > 1 &&
+ @nodes.size < Namespace::NUMBER_OF_ANCESTORS_ALLOWED
end
def components