We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 727f80d + 2bae058 commit 56cff07Copy full SHA for 56cff07
1 file changed
reference.go
@@ -228,12 +228,14 @@ func splitDomain(name string) (string, string) {
228
// _ "crypto/sha256"
229
// )
230
func Parse(s string) (Reference, error) {
231
+ if s == "" {
232
+ return nil, ErrNameEmpty
233
+ }
234
+
235
matches := ReferenceRegexp.FindStringSubmatch(s)
236
if matches == nil {
- if s == "" {
- return nil, ErrNameEmpty
- }
- if ReferenceRegexp.FindStringSubmatch(strings.ToLower(s)) != nil {
237
+ if sl := strings.ToLower(s); sl != s && ReferenceRegexp.FindStringSubmatch(sl) != nil {
238
+ // Succeeds when lower-casing, so input contains an invalid repository name.
239
return nil, ErrNameContainsUppercase
240
}
241
return nil, ErrReferenceInvalidFormat
0 commit comments