File tree Expand file tree Collapse file tree 3 files changed +10
-6
lines changed
main/groovy/io/seqera/wave
test/groovy/io/seqera/wave/service/validation Expand file tree Collapse file tree 3 files changed +10
-6
lines changed Original file line number Diff line number Diff line change @@ -53,7 +53,8 @@ class ContainerCoordinates implements ContainerPath {
5353 static ContainerCoordinates parse (String path ) {
5454 if ( ! path )
5555 throw new IllegalArgumentException (" Container image name is not provided" )
56-
56+ if ( path. contains(' ' ) )
57+ throw new IllegalArgumentException (" Invalid container name - offending image: '$path '" )
5758 final scheme = StringUtils . getUrlProtocol(path)
5859 if ( scheme ) {
5960 if ( scheme!= ' oras' ) throw new IllegalArgumentException (" Invalid container scheme: '$scheme ' - offending image: '$path '" )
Original file line number Diff line number Diff line change @@ -68,14 +68,14 @@ class ValidationServiceImpl implements ValidationService {
6868 // check does not start with a protocol prefix
6969 final prot = StringUtils . getUrlProtocol(name)
7070 if ( prot ) {
71- return " Invalid container repository name — offending value: $name "
71+ return " Invalid container repository name — offending value: ' $name ' "
7272 }
7373
7474 try {
7575 ContainerCoordinates . parse(name)
7676 }
7777 catch (IllegalArgumentException e) {
78- return " Invalid container image name — offending value: $name "
78+ return " Invalid container image name — offending value: ' $name ' "
7979 }
8080 return null
8181 }
Original file line number Diff line number Diff line change @@ -80,9 +80,12 @@ class ValidationServiceTest extends Specification {
8080 ' quay.io:80/foo:latest' | null
8181 ' localhost:8000/foo:latest' | null
8282 and :
83- ' docker:quay.io/foo:latest' | ' Invalid container image name — offending value: docker:quay.io/foo:latest'
84- ' http://quay.io/foo:latest' | ' Invalid container repository name — offending value: http://quay.io/foo:latest'
85- ' http://quay.io/foo:latest' | ' Invalid container repository name — offending value: http://quay.io/foo:latest'
83+ ' docker:quay.io/foo:latest' | " Invalid container image name — offending value: 'docker:quay.io/foo:latest'"
84+ ' http://quay.io/foo:latest' | " Invalid container repository name — offending value: 'http://quay.io/foo:latest'"
85+ ' http://quay.io/foo:latest' | " Invalid container repository name — offending value: 'http://quay.io/foo:latest'"
86+ ' ubuntu: latest' | " Invalid container image name — offending value: 'ubuntu: latest'"
87+ ' ubuntu:latest ' | " Invalid container image name — offending value: 'ubuntu:latest '"
88+ ' ' | " Invalid container image name — offending value: ' '"
8689 }
8790
8891 @Unroll
You can’t perform that action at this time.
0 commit comments