Commit f2d41b85 authored by Brian Williams's avatar Brian Williams

Fix docker image parsing when image address contains a port

parent 8509751e
......@@ -31,7 +31,7 @@ module Gitlab
def docker_image_name_without_tag
image_name = default_branch_image.presence || image
base_name, version = image_name.split(':')
base_name, _, version = image_name.rpartition(':')
return image if version_semver_like?(version)
......
......@@ -18,11 +18,11 @@ RSpec.describe Gitlab::Ci::Reports::Security::Locations::ContainerScanning do
it_behaves_like 'vulnerability location'
subject { described_class.new(**params) }
describe 'fingerprint' do
sha1_of = -> (input) { Digest::SHA1.hexdigest(input) }
subject { described_class.new(**params) }
context 'with feature enabled' do
before do
stub_feature_flags(improved_container_scan_matching: true)
......@@ -34,6 +34,11 @@ RSpec.describe Gitlab::Ci::Reports::Security::Locations::ContainerScanning do
['alpine:3.7', nil, 'alpine:3.7:glibc'],
['alpine:8101518288111119448185914762536722131810', nil, 'alpine:glibc'],
['alpine:1.0.0-beta', nil, 'alpine:1.0.0-beta:glibc'],
[
'gdk.local:5000/group/project/branch:307e0a35643f63652a713d0820db7c388012f724',
nil,
'gdk.local:5000/group/project/branch:glibc'
],
[
'registry.gitlab.com/group/project/tmp:af864bd61230d3d694eb01d6205b268b4ad63ac0',
nil,
......
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