From 985ee759e72258ebb8acec5d0f52cfa2249c3641 Mon Sep 17 00:00:00 2001 From: Aaron Lehmann Date: Wed, 28 Oct 2015 18:22:00 -0700 Subject: [PATCH] Use correct regexp in reference.WithTag This was using a different regexp from the intended one. This meant that tags with uppercase characters were not accepted. Signed-off-by: Aaron Lehmann --- reference/reference.go | 2 +- reference/reference_test.go | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/reference/reference.go b/reference/reference.go index b479df047..48b910e44 100644 --- a/reference/reference.go +++ b/reference/reference.go @@ -213,7 +213,7 @@ func WithName(name string) (Named, error) { // WithTag combines the name from "name" and the tag from "tag" to form a // reference incorporating both the name and the tag. func WithTag(name Named, tag string) (NamedTagged, error) { - if !anchoredNameRegexp.MatchString(tag) { + if !anchoredTagRegexp.MatchString(tag) { return nil, ErrTagInvalidFormat } return taggedReference{ diff --git a/reference/reference_test.go b/reference/reference_test.go index 767a2b3b2..2096fdaa4 100644 --- a/reference/reference_test.go +++ b/reference/reference_test.go @@ -417,6 +417,11 @@ func TestWithTag(t *testing.T) { tag: "tag4", combined: "test.com:8000/foo:tag4", }, + { + name: "test.com:8000/foo", + tag: "TAG5", + combined: "test.com:8000/foo:TAG5", + }, } for _, testcase := range testcases { failf := func(format string, v ...interface{}) {