Commit 91d48fd8 authored by Mikołaj Wawrzyniak's avatar Mikołaj Wawrzyniak

Merge branch '345920-dp-regex-update' into 'master'

Update Dependency Proxy container_image regex to allow 4 levels

See merge request gitlab-org/gitlab!80929
parents e71c7e15 410c9709
......@@ -255,7 +255,7 @@ module Gitlab
end
def container_image_regex
@container_image_regex ||= %r{([\w\.-]+\/){0,1}[\w\.-]+}.freeze
@container_image_regex ||= %r{([\w\.-]+\/){0,4}[\w\.-]+}.freeze
end
def container_image_blob_sha_regex
......
......@@ -549,10 +549,11 @@ RSpec.describe Gitlab::PathRegex do
it { is_expected.to match('gitlab-foss') }
it { is_expected.to match('gitlab_foss') }
it { is_expected.to match('gitlab-org/gitlab-foss') }
it { is_expected.to match('a/b/c/d/e') }
it { is_expected.to match('100px.com/100px.ruby') }
it 'only matches at most one slash' do
expect(subject.match('foo/bar/baz')[0]).to eq('foo/bar')
it 'does not match beyond 4 slashes' do
expect(subject.match('foo/bar/baz/buz/zip/zap/zoo')[0]).to eq('foo/bar/baz/buz/zip')
end
it 'does not match other non-word characters' do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment