Merge branch 'fix/gb/update-registry-path-reference-regexp' into 'master'
Update container repository path reference Closes #40199 See merge request gitlab-org/gitlab-ce!15417
This commit is contained in:
commit
e07b0bd295
3 changed files with 24 additions and 1 deletions
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
title: Update container repository path reference and allow using double underscore
|
||||
merge_request: 15417
|
||||
author:
|
||||
type: fixed
|
|
@ -25,7 +25,7 @@ module Gitlab
|
|||
# See https://github.com/docker/distribution/blob/master/reference/regexp.go.
|
||||
#
|
||||
def container_repository_name_regex
|
||||
@container_repository_regex ||= %r{\A[a-z0-9]+(?:[-._/][a-z0-9]+)*\Z}
|
||||
@container_repository_regex ||= %r{\A[a-z0-9]+((?:[._/]|__|[-])[a-z0-9]+)*\Z}
|
||||
end
|
||||
|
||||
##
|
||||
|
|
|
@ -86,6 +86,24 @@ describe ContainerRegistry::Path do
|
|||
|
||||
it { is_expected.to be_valid }
|
||||
end
|
||||
|
||||
context 'when path contains double underscore' do
|
||||
let(:path) { 'my/repository__name' }
|
||||
|
||||
it { is_expected.to be_valid }
|
||||
end
|
||||
|
||||
context 'when path contains invalid separator with dot' do
|
||||
let(:path) { 'some/registry-.name' }
|
||||
|
||||
it { is_expected.not_to be_valid }
|
||||
end
|
||||
|
||||
context 'when path contains invalid separator with underscore' do
|
||||
let(:path) { 'some/registry._name' }
|
||||
|
||||
it { is_expected.not_to be_valid }
|
||||
end
|
||||
end
|
||||
|
||||
describe '#has_repository?' do
|
||||
|
|
Loading…
Reference in a new issue