File tree Expand file tree Collapse file tree 2 files changed +4
-2
lines changed Expand file tree Collapse file tree 2 files changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -43,7 +43,7 @@ export async function removePulledImages(images: IPullableImage[]): Promise<void
4343// Exported for testing
4444export function getImageParts ( imageWithTag : string ) : { imageName : string , imageTag : string } {
4545 // we're matching pattern: <registry:port_number>(optional)/<image_name>(mandatory)@<tag_identifier>(optional):<image_tag>(optional)
46- const regex = / ( (?: .* ( : \d { 4 } ) ? \/ ) ? (?: [ a - z 0 - 9 ] + ) ) ( [ @ | : ] .+ ) ? / ig;
46+ const regex = / ( (?: .* ( : \d { 4 } ) ? \/ ) ? (?: [ a - z 0 - 9 - ] + ) ) ( [ @ | : ] .+ ) ? / ig;
4747 const groups = regex . exec ( imageWithTag ) ;
4848
4949 if ( ! groups ) {
Original file line number Diff line number Diff line change @@ -85,10 +85,12 @@ tap.test('extracted image tag tests', async (t) => {
8585} ) ;
8686
8787tap . test ( 'extracted image name tests' , async ( t ) => {
88- t . plan ( 4 ) ;
88+ t . plan ( 5 ) ;
8989
9090 t . same ( scannerImages . getImageParts ( 'nginx:latest' ) . imageName , 'nginx' , 'removed image:tag' ) ;
9191 t . same ( scannerImages . getImageParts ( 'nginx:@sha256:1234567890abcdef' ) . imageName , 'nginx' , 'removed malformed image:@sha:hex' ) ;
9292 t . same ( scannerImages . getImageParts ( 'node@sha256:215a9fbef4df2c1ceb7c79481d3cfd94ad8f1f0105bade39f3be907bf386c5e1' ) . imageName , 'node' , 'removed image@sha:hex' ) ;
9393 t . same ( scannerImages . getImageParts ( 'kind-registry:5000/python:rc-buster' ) . imageName , 'kind-registry:5000/python' , 'removed repository/image:tag' ) ;
94+ // Verify support on image names that contain dashes
95+ t . same ( scannerImages . getImageParts ( 'kind-registry:5000/python-27:rc-buster' ) . imageName , 'kind-registry:5000/python-27' , 'removed repository/image:tag' ) ;
9496} ) ;
You can’t perform that action at this time.
0 commit comments