Merge pull request #4739 from kzys/handle-scheme

Handle an image ref with scheme
This commit is contained in:
Phil Estes 2020-12-01 14:37:16 -05:00 committed by GitHub
commit 774cb16a44
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 6 deletions

View File

@ -85,6 +85,10 @@ var splitRe = regexp.MustCompile(`[:@]`)
// Parse parses the string into a structured ref.
func Parse(s string) (Spec, error) {
if strings.Contains(s, "://") {
return Spec{}, ErrInvalid
}
u, err := url.Parse("dummy://" + s)
if err != nil {
return Spec{}, err

View File

@ -151,7 +151,6 @@ func TestReferenceParser(t *testing.T) {
},
},
{
Skip: true, // TODO(stevvooe): Implement this case.
Name: "SchemeDefined",
Input: "http://xn--7o8h.com/myimage:xn--7o8h.com@sha512:fffffff",
Hostname: "xn--7o8h.com",
@ -160,11 +159,6 @@ func TestReferenceParser(t *testing.T) {
},
} {
t.Run(testcase.Name, func(t *testing.T) {
if testcase.Skip {
t.Skip("testcase disabled")
return
}
ref, err := Parse(testcase.Input)
if err != testcase.Err {
if testcase.Err != nil {