From aa0d00674a9b836954c74dfa805798cfc267f1c2 Mon Sep 17 00:00:00 2001
From: Mike Brown <brownwm@us.ibm.com>
Date: Thu, 3 Jun 2021 15:58:11 -0500
Subject: [PATCH] fix invalid validation error checking

Signed-off-by: Mike Brown <brownwm@us.ibm.com>
---
 metadata/containers.go | 2 +-
 metadata/content.go    | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/metadata/containers.go b/metadata/containers.go
index 6e5622c36..30ef44c33 100644
--- a/metadata/containers.go
+++ b/metadata/containers.go
@@ -259,7 +259,7 @@ func validateContainer(container *containers.Container) error {
 
 	// image has no validation
 	for k, v := range container.Labels {
-		if err := labels.Validate(k, v); err == nil {
+		if err := labels.Validate(k, v); err != nil {
 			return errors.Wrapf(err, "containers.Labels")
 		}
 	}
diff --git a/metadata/content.go b/metadata/content.go
index 8ee0f2e20..4f352ca26 100644
--- a/metadata/content.go
+++ b/metadata/content.go
@@ -689,7 +689,7 @@ func (cs *contentStore) checkAccess(ctx context.Context, dgst digest.Digest) err
 
 func validateInfo(info *content.Info) error {
 	for k, v := range info.Labels {
-		if err := labels.Validate(k, v); err == nil {
+		if err := labels.Validate(k, v); err != nil {
 			return errors.Wrapf(err, "info.Labels")
 		}
 	}
-- 
2.33.0

